Here's some quick hints:
1) use the following statement to redirect debug messages and
variables to a file.
SET DEBUG FILE TO "filename"
2) use the TRACE statement in one of the following ways to do what you want:
TRACE ON;
TRACE spl-expression;
where spl-expression is any Stored Procedure Expression. Example:
TRACE "Foreach starts";
TRACE variable-name1 * variable-name2;
Note: values of variables (in expressions or otherwise) are printed
before they are used.
3) You might want to use the ON EXCEPTION IN (sqlcode error number)
to trap the error then do some TRACE statements in the exception
handler to see what is happening. For example,
ON EXCEPTION IN (-691)
SET sqlcode-error, isam-error, error-desc
TRACE isam-error;
TRACE variable-2;
END EXCEPTION
Note: the exception block is declarative and must appear after DEFINE
statements but before any LET statements, FOREACH statements, etc.
Have fun. Debugging stored procedures is tough. By the way, if you're
trying to get the SYSTEM statement to work, good luck. I've had so
many problems with this that to me it is basically useless!!!!
- dave kaneshiro
dkaneshi@msn.com