Informix Error -687: Set debug file before tracing SPL routines.
Cause and resolution
Set debug file before tracing SPL routines.
A TRACE statement was executed before a SET DEBUG FILE statement. The destination of the output of the TRACE statement is unknown. This error can also apply to the TRACE OFF statement.
Example of error:
TRACE procedure; -- error
Correction:
SET DEBUG FILE TO 'trace.out'; TRACE procedure;
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-687 fires when TRACE (or TRACE OFF) is executed before SET DEBUG FILE TO — per the
official guidance, TRACE's output has no destination until a debug file has been set.
TRACE procedure_nameexecuted with no priorSET DEBUG FILE TO, per the official guidance's own example — the direct, common cause.TRACE OFFexecuted without ever having set a debug file in the session, per the official guidance's note that this applies toTRACE OFFtoo.SET DEBUG FILE TOexecuted in a different session/connection than the one issuingTRACE— the debug file setting is session-scoped, so setting it elsewhere doesn't help this session.
Solutions / Resolution
- Issue
SET DEBUG FILE TObeforeTRACE, per the official guidance's documented correction:SET DEBUG FILE TO 'trace.out'; TRACE procedure_name; - Confirm
SET DEBUG FILE TOandTRACErun in the same session, if the error persists despite having set a debug file somewhere.
Examples
The disallowed order
TRACE procedure_name;
-- -687: no debug file has been set yet
Corrected
SET DEBUG FILE TO 'trace.out';
TRACE procedure_name;
Diagnostic Checks
- Check whether
SET DEBUG FILE TOran earlier in the same session, before theTRACE/TRACE OFFstatement that failed.
Related Errors / Related Topics
- -648 — "Cannot open DEBUG file for SPL routine trace." A related
SET DEBUG FILEerror, about the path's validity onceSET DEBUG FILE TOis actually issued. - -649 — "The debug file name must be a NON-NULL CHAR or VARCHAR." A related
SET DEBUG FILEerror, about the argument's type.
TRACE needs SET DEBUG FILE TO first, in the same session — check the statement order before
troubleshooting anything else.