CHGDBG (Change Debug)
Purpose
The Change Debug (CHGDBG) command changes the attributes of the debugging session currently in effect for a job. All of the attributes can be changed, except which programs to debug. Use the Add Program (ADDPGM) command or the Remove Program (RMVPGM) commands to add or remove a program from debug mode.
Restrictions: This command is valid only in debug mode. To start debug mode, see the STRDBG (Start Debug) command. If the user is servicing another job, and that job is ending, this command is not allowed.
Optional Parameters
- DFTPGM
- Specifies the name of the OPM program to use as the default program during debug mode. The program specified here is used as the default program for any of the other debug commands that specify *DFTPGM on their PGM parameter. (That is, if a default program was previously specified, this parameter can change it.)
This parameter is applicable only in the OPM environment.
*SAME: The value does not change.
*NONE: No program is specified as the default program; if a program was specified as a default program, it is no longer the default program. If the job has no default program, *DFTPGM cannot be specified on the PGM parameter of any other debug commands.
program-name: Specify the name of the program to use as the default program during debug mode. The same name must already have been specified in the PGM parameter of the STRDBG command or ADDPGM command.
- MAXTRC
- Specifies the maximum number of trace statements that the system puts into the job's trace file before either stopping tracing or wrapping around (overlaying) on the trace file. When the trace file contains the maximum specified, the system performs the actions specified in the TRCFULL parameter.
Note: Instruction stepping can be performed on a program being debugged in an interactive environment by setting the maximum number of trace statements to 1 and the TRCFULL parameter to *STOPTRC. This parameter is applicable only in the OPM environment.
*SAME: The value does not change.
maximum-trace-statements: Specify the maximum number of trace statements that can be in the trace file.
- TRCFULL
- Specifies what happens when the job's trace file is full (that is, it contains the maximum number of trace statements specified by the MAXTRC parameter).
This parameter is applicable only in the OPM environment.
*SAME: The value does not change.
*STOPTRC: In a batch environment, tracing stops but the program continues processing. In an interactive environment, control is given to the user when a breakpoint occurs. If the user continues processing, a breakpoint occurs before processing each subsequent statement within the range of statements being traced, and the trace file is extended to contain the new entry.
*WRAP: The trace file is overlaid with new trace statements as they occur, wrapping from the beginning of the file. The program continues processing until completed with no message to indicate that wrapping has occurred. The trace file never has more than the maximum specified statements, and they are the most recently recorded statements.
- UPDPROD
- Specifies whether or not database files in a production library can be opened for changes (that is, for adding, deleting, or changing records in the file) while the job is in debug mode. If not, the files must be copied into a test library before trying to run a program that uses the files.
This parameter is applicable in both the OPM and ILE environments.
*SAME: The value does not change.
*NO: Database files in production libraries cannot be changed during debug mode. Database files can be opened for reading only.
*YES: Database files in production libraries can be changed while the job is in debug mode.
- OPMSRC
- Specifies that OPM programs will be debugged using the system source debug support (same as ILE source debug).
This parameter is valid for OPM CL, OPM RPG and OPM COBOL programs that were created with OPTION(*SRCDBG) with CRTCLPGM, CRTRPGPGM and CRTCBLPGM commands. Additionally, this parameter is valid for OPM RPG and OPM COBOL programs that were created with OPTION(*LSTDBG) with CRTRPGPGM, CRTCBLPGM, CRTSQLRPG, CRTSQLCBL, and CRTRPTRPG commands. If the OPM program is not CL, RPG or COBOL and was not compiled with a valid debug option, then this parameter is ignored.
OPM programs already added to debug prior to the CHGDBG command will continue to be active under the debug environment (ILE or OPM) they are currently active under. Programs added to debug after the CHGDBG command is issued are affected by the OPMSRC parameter.
This parameter is applicable in both the OPM and ILE environments.
*SAME: The value does not change.
*NO: OPM debug functions will be used for OPM programs.
*YES: ILE debug functions will be used for OPM programs.
Example for CHGDBG
CHGDBG MAXTRC(400) TRCFULL(*STOPTRC)This command changes the maximum number of trace statements that can be put in the trace file to 400. The tracing is stopped when the file is full.
Error messages for CHGDBG
*ESCAPE Messages
- CPF1999
- Errors occurred on command.