Debugging a stored procedure

To debug a stored procedure, it must be built with specific compiler and runtime options.

Before you begin

Specify a compiler listing data set as described in Setting up the z/OS® build properties if you want to debug a COBOL stored procedure that is not specified yet.

About this task

For an alternative method for debugging stored procedures, see ../../com.ibm.debug.pdt.zpcl.doc/topics/czddb2debug.html.

Procedure

  1. Edit the property group that is associated with the store procedure.
  2. On the Procedures and Steps page of the COBOL Settings or PL/I Settings, open the Step options for the enabled compilation step.
  3. In the Compiler options field, specify TEST.
    You must also specify a listing data set in the property group. If you use the TEST(NONE,SYM,SEP) compiler option, you must specify a SYSDEBUG data set.
  4. Close and save the property group.
  5. Update the DDL for the stored procedure to specify run options:
    1. To open the DDL for the stored procedure, selecting the Open DDL menu item.
    2. Add the stored procedure option RUN OPTIONS.
      The following example shows the RUN OPTIONS suboption of the CREATE PROCEDURE statement. In this example, the user's IP address is 9.77.111.111. The debug listener in the debug perspective is listening on the default port, 8001.
      RUN OPTIONS 'TEST(,,,TCPIP&9.77.111.111%8001:*)'
  6. Build the stored procedure as described in Building a stored procedure.
  7. Run the stored procedure as described in Running a stored procedure.
    The Debug perspective opens automatically when the stored procedure started.
  8. Click OK if the following message is displayed:
    • EQA2383I The environment is not yet fully initialized. Use Step or Run.

    Breakpoints can be set by double-clicking the gray vertical bar on the right side of the Source view.

  9. Click Resume on the window bar of the Debug view to run from one breakpoint to the next.
  10. Click Step Into on the window bar of the Debug view to step from one statement to the next.
  11. Change variable values by double-clicking the variable in the Variables view of the Debug perspective, typing the new value for the variable, and clicking OK.
    The values of the variables are displayed in the Variables view of the Debug perspective.
  12. Click OK if the following exception occurs when you debug a PL/I stored procedure:
    • The following exception has occurred: IBM0368W The FINISH condition was raised due to a RETURN or END statement in the main procedure.
  13. Click OK when the Debugger Message window says that the Application is Terminated.
  14. Click Data Perspective to switch back to the Data Perspective.