informix
Informix Guide to SQL: Syntax
SQL Statements

SET DEBUG FILE TO

Use the SET DEBUG FILE TO statement to name the file that is to hold the run-time trace output of an SPL routine.

Syntax

Element Purpose Restrictions Syntax
expression Expression that evaluates to a filename The filename that is derived from the expression must be usable. The same restrictions apply to the derived filename as to the filename parameter. Expression, p. 4-73
filename Quoted string that identifies the pathname of the file that contains the output of the TRACE statement For information on the default actions that are taken if you omit the pathname, see Location of the Output File. You can specify a new or existing file. If you specify an existing file, you must include the WITH APPEND keywords if you want to preserve the current contents of the file intact. For further information, see Using the WITH APPEND Option. Quoted String, p. 4-260. Name must conform to the naming conventions of your operating system.
filename_var Host variable that holds the value of filename The host variable must be a character data type. Name must conform to language-specific rules for variable names.

Usage

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.

Using the WITH APPEND Option

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.

Closing the Output File

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.

Redirecting Trace Output

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.

Location of the Output File

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.

Example of the SET DEBUG FILE TO Statement

The following example sends the output of the SET DEBUG FILE TO statement to a file called debug.out:

Related Information

Related statement: TRACE

For a task-oriented discussion of SPL routines, see the Informix Guide to SQL: Tutorial.


Informix Guide to SQL: Syntax, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved