Add programs to debug mode

Before you can debug a program, you must put it in debug mode.

Any program can be run in debug mode. You can place a program in debug mode by specifying it in the PGM parameter on the Start Debug (STRDBG) command or by adding it to the debugging session with an Add Program (ADDPGM) command. You can specify as many as twenty (20) programs to be debugged simultaneously in a job. You must have *CHANGE authority to add a program to debug mode.

If you specified twenty (20) programs for debug mode (using either the Start Debug (STRDBG) or Add Program (ADDPGM) command or both commands) and you want to add more programs to the debug job, you must remove some of the previously specified programs. Use the Remove Program (RMVPGM) command. When debug mode ends, all programs are automatically removed from debug mode.

When you start debug mode, you can specify that a program be a default program. By specifying a default program, you can use any debug command that has the PGM parameter without having to specify a program name each time a command is used. This is helpful if you are only debugging one program. For example, in the Add Breakpoint (ADDBKP) command, you would not specify a program name on the PGM parameter because the default program is assumed to be the program the breakpoint is being added to. The default program name must be specified in the list of programs to be debugged (PGM parameter). If more than one program is listed to be debugged, you can specify the default program on the DFTPGM parameter. If you do not, the first program in the list on the PGM parameter on the STRDBG command is assumed to be the default program.

The default program can be changed any time during testing by using either the Change Debug (CHGDBG) or the Add Program (ADDPGM) command.

Note: If a program that is in debug mode is deleted, recreated, or saved with storage freed, references made to that program (except a Remove Program (RMVPGM) command) may result in a function check. You must either remove the program using a RMVPGM command or end debug mode using an End Debug (ENDDBG) command. If you want to change the program and then debug it, you must remove it from debug mode and after it is recreated, add it to debug mode (Add Program (ADDPGM) command).
Related information
Change Debug (CHGDBG) command
Add Program (ADDPGM) command
Start Debug (STRDBG) command
Remove Program (RMVPGM) command
CL command finder