Debugging DB2 programs
While you debug a program containing SQL statements, remember the
following behaviors:
- The SQL preprocessor replaces all the SQL statements in the program
with host language code. The modified source output from the preprocessor
contains the original SQL statements in comment form. For this reason,
the source or listing view displayed during a debugging session can
look very different from the original source.
- The host language code inserted by the SQL preprocessor starts
the SQL access module for your program. You can halt program execution
at each call to a SQL module and immediately following each call to
a SQL module, but the called modules cannot be debugged.
- A host language SQL coprocessor performs DB2® precompiler functions at compile time and replaces
the SQL statements in the program with host language code. However,
the generated host language code is not displayed during a debug session;
the original source code is displayed.
The topics below describe the steps you need to follow to use Debug Tool to
debug your DB2 programs.
Refer to the following topics for more information
related to the material discussed in this topic.
Debugging DB2 programs
in batch mode
In order to debug your program with Debug Tool while in batch mode,
follow these steps:
- Make sure the Debug Tool modules are available, either by STEPLIB
or through the LINKLIB.
- Provide all the data set definitions in the form of DD statements
(example: Log, Preference, list, and so on).
- Specify your debug commands in the command input file.
- Run your program through the TSO batch facility.
Refer to the following topics for more information
related to the material discussed in this topic.
Debugging DB2 programs
in full-screen mode
In full-screen mode, you can decide at debug time what debugging
commands you want issued during the test.
Using Debug Tool Setup Utility (DTSU)
The Debug Tool Setup Utility is available through Debug Tool Utilities.
- Start DTSU by using the TSO command or the ISPF panel option,
if available. Contact your system administrator to determine if the
ISPF panel option is available.
- Create a setup file. Remember to select the Initialize
New setup file for DB2 field.
- Enter appropriate information for all the fields. Remember
to enter the proper commands in the DSN command options and
the RUN command options fields.
- Enter the RUN command to run the DB2 program.
Using TSO commands
- Ensure that either you or your system programmer has allocated
all the required data sets through a CLIST or REXX EXEC.
- Issue the DSN command to start DB2.
- Issue the RUN subcommand to execute your program. You
can specify the TEST runtime option as a parameter on the RUN subcommand.
The following example starts a COBOL program:
RUN PROG(progname) PLAN(planname) LIB('user.library')
PARMS('/TEST(,*,;,*)')
The
following example starts a non-Language Environment COBOL program:
RUN PROG(EQANMDBG) PLAN(planname) LIB('user.library')
PARMS('progname,/TEST(,*,;,*)')
Using TSO/Call Access Facility (CAF)
- Link-edit the CAF language interface module DSNALI with your program.
- Ensure that the data sets required by Debug Tool and your program
have been allocated through a CLIST or REXX procedure.
- Enter the TSO CALL command CALL 'user.library(name
of your program)', to start your program. Include the TEST run-time
option as a parameter in this command.
In full-screen mode using a dedicated terminal without the Debug Tool Terminal Interface
Manager
- Specify the MFI%LU_name parameter as part
of the TEST runtime option.
- Follow the other requirements for debugging DB2 programs either under TSO or in batch mode.
In full-screen mode using a dedicated terminal with the Debug Tool Terminal Interface
Manager
- Specify the VTAM%userid parameter as part
of the TEST runtime option.
- Follow the other requirements for debugging DB2 programs either under TSO or in batch mode.
After your program has been initiated, debug your program by issuing
the required Debug Tool commands.
Note:
If your source does not come up in Debug Tool when you
launch it, check that the listing or source file name corresponds
to the MVS™ library name, and
that you have at least read access to that MVS library.
Refer to the following topics for more information
related to the material discussed in this topic.
- Related
references
- DB2 UDB for z/OS Administration
Guide