Debugging stored procedures with z/OS Debugger

You can use z/OS Debugger to test z/OS routines, including stored procedures, that are written in any of the compiled languages that it supports. You can test these stored procedures either interactively or in batch mode.

Procedure

To debug your routine with z/OS Debugger, use one of the following approaches:

  • Use z/OS Debugger interactively by completing the following steps.
    1. Compile the routine with the TEST option. The TEST option places information in the program that z/OS Debugger uses during a debugging session.
    2. Invoke z/OS Debugger.
      One way to do that is to specify the Language Environment run time option TEST. The TEST option controls when and how z/OS Debugger is invoked. The most convenient place to specify run time options is in the RUN OPTIONS parameter of the CREATE PROCUDURE or ALTER PROCEDURE statement for the stored procedure. For more information, see Preparing a Db2 stored procedures program.
      For example, you can code the TEST option using the following parameters:
      TEST(ALL,*,PROMPT,TCPIP&ABC.EXAMPLE.COM%8001:*:)
    For more information about interactive debugging from various interfaces, see the following topics:
  • Use z/OS Debugger in batch mode by completing the following steps. z/OS Debugger must be installed on the z/OS system where the stored procedure runs.
    1. Compile the stored procedure with the TEST option if you plan to use the Language Environment® run time option TEST to invoke z/OS Debugger. The TEST option places information in the program that z/OS Debugger uses during a debugging session.
    2. Allocate a log data set to receive the output from z/OS Debugger. Put a DD statement for the log data set in the start-up procedure for the stored procedures address space.
    3. Enter commands in a data set that you want z/OS Debugger to execute. Put a DD statement for that data set in the start-up procedure for the stored procedures address space. To define the commands data set to z/OS Debugger, specify the commands data set name or DD name in the TEST run time option.
      For example, to specify that z/OS Debugger uses the commands that are in the data set that is associated with the DD name TESTDD, include the following parameter in the TEST option:
      TEST(ALL,TESTDD,PROMPT,*)

      The first command in the commands data set should be:

      SET LOG ON FILE ddname;

      This command directs output from your debugging session to the log data set that you defined in the previous step. For example, if you defined a log data set with DD name INSPLOG in the stored procedures address space start-up procedure, the first command should be the following command:

      SET LOG ON FILE INSPLOG;
    4. Invoke z/OS Debugger by using one of the following methods:
      • Specify the run time option TEST. The most convenient place to do that is in the RUN OPTIONS parameter of the CREATE or ALTER statement for the stored procedure.
      • Put CEETEST calls in the stored procedure source code. If you use this approach for an existing stored procedure, you must recompile, re-link, and bind it, and issue the STOP PROCEDURE and START PROCEDURE commands to reload the stored procedure.

      You can combine the run time option TEST with CEETEST calls. For example, you might want to use TEST to name the commands data set but use CEETEST calls to control when z/OS Debugger takes control.

    For more information, see Starting z/OS Debugger in batch mode.