You can debug external stored procedures and external SQL
procedures by recording debugging messages in a disk file or in a
JES spool file. You cannot use this debugging technique for native
SQL procedures or Java™ stored
procedures.
Procedure
To record stored procedure debugging messages in a file:
- Specify the Language Environment® (LE) MSGFILE run time option for the stored procedure.
This option identifies where LE is to write the debugging messages.
To specify this option, include the RUN OPTIONS clause in either the
CREATE PROCEDURE statement or an ALTER PROCEDURE statement.
Specify
the following MSGFILE parameters:
- Use the first MSGFILE parameter to specify the JCL DD statement
that identifies the data set for the debugging messages. You can direct
debugging messages to a disk file or JES spool file. To prevent multiple
procedures from sharing a data set, ensure that you specify a unique
DD statement.
- Use the ENQ option to serialize I/O to the message file. This
action is necessary, because multiple TCBs can be active in the stored
procedure address space. Alternatively, if you debug your applications
infrequently or on a Db2 test
system, you can serialize I/O by temporarily running the stored procedures
address space with NUMTCB=1 in the stored procedures address space
start-up procedure.
- For each instance of MSGFILE that you specify, add a DD
statement to the JCL procedure that is used to start the stored procedures
address space.