|
Use the SET DEBUG FILE TO statement to name the file that is to hold the run-time trace output of an SPL routine.
This statement indicates that the output of the TRACE statement in the SPL routine goes to the file that filename indicates. Each time the TRACE statement is executed, the trace data is added to this output file.
The output file that you specify in the SET DEBUG TO file statement can be a new file or existing file.
If you specify an existing file, the current contents of the file are purged when you issue the SET DEBUG TO FILE statement. The first execution of a TRACE command sends trace output to the beginning of the file.
However, if you include the WITH APPEND option, the current contents of the file are preserved when you issue the SET DEBUG TO FILE statement. The first execution of a TRACE command adds trace output to the end of the file.
If you specify a new file in the SET DEBUG TO FILE statement, it makes no difference whether you include the WITH APPEND option. The first execution of a TRACE command sends trace output to the beginning of the new file whether you include or omit the WITH APPEND option.
To close the file that the SET DEBUG FILE TO statement opened, issue another SET DEBUG FILE TO statement with another filename. You can then edit the contents of the first file.
You can use the SET DEBUG FILE TO statement outside an SPL routine to direct the trace output of the SPL routine to a file. You also can use this statement inside an SPL routine to redirect its own output.
If you invoke a SET DEBUG FILE TO statement with a simple filename on a local database, the output file is located in your current directory. If your current database is on a remote database server, the output file is located in your home directory on the remote database server. If you provide a full pathname for the debug file, the file is placed in the directory and file that you specify on the remote database server. If you do not have write permissions in the directory, you get an error.
The following example sends the output of the SET DEBUG FILE TO statement to a file called debug.out:
Related statement: TRACE
For a task-oriented discussion of SPL routines, see the Informix Guide to SQL: Tutorial.