CL Command Reference - ADDBKP

CL Command List > ADDBKP Reference

Description:

The Add Breakpoint (ADDBKP) command sets up to ten breakpoints in a program. A breakpoint is a location in a program where processing stops and control is given to the user or to a specified program. The breakpoint is set when a statement number or label of a command or machine instruction is specified. The program is stopped just before processing begins on the statement (or machine instruction) on which the breakpoint is set.

This command shows the values of certain program variables when any breakpoint in the program is reached. As many as 10 variables per breakpoint can be specified, and as many as 10 breakpoints per command can be set. However, the same program variables apply to every breakpoint specified in the command. To specify different sets of variables for each breakpoint, you must use separate commands.

This command specifies conditional breakpoints in which the program is stopped when a condition is true. This condition involves two program variables or one program variable and a constant. When using conditional breakpoints, it is possible to stop the program when a program variable becomes a certain value.

A conditional breakpoint can also be specified by specifying a skip value. The program does not stop until the breakpoint statements have been processed as many times as the skip number indicates. After that, the breakpoint causes the program to stop.

When a breakpoint is reached in the interactive debugging environment, a display is shown to the user that identifies which breakpoint has been reached and (optionally) shows the values of the specified program variables when the program is stopped. This information is also written to the job log. From the display, the user can press the F10 key to show the command entry display, or press the F3 key to exit the display and cancel the program. The user can press the Enter key to allow the program to continue running.

When a breakpoint is reached in the batch debugging environment, the breakpoint information is written to a printer file and, optionally, another program can be called to take action on the breakpoint condition. The name of the called program is specified on the Breakpoint program to call (BKPPGM) parameter.

When an interactive job is debugging another job and a breakpoint is reached in the debugged job, a breakpoint display is shown. This display appears in the debugging job, interrupting what was previously being displayed. You must press the Enter key, allowing the stopped program to continue, before returning to the previous display.



Examples:

Example 1: Adding Breakpoints in Debug Mode

ADDBKP STMT(150 RTN1 205) PGMVAR(¡¯&TEMP¡¯ ¡¯&INREC¡¯)

This command establishes breakpoints at CL statement numbers 150 and 205 and at the label RTN1 for the default program in debug mode. When any of these breakpoints is reached, the CL variables &TEMP and &INREC are automatically shown. Note that the CL variables must include a leading ampersand (&) and be specified within apostrophes.



Example 2: Adding Breakpoints to HLL Program

ADDBKP STMT(100) PGMVAR(¡¯AMOUNT(200)¡¯) PGM(MYPROG)

Assume in this example that MYPROG is a high-level language program being debugged in an interactive environment and that the program variable AMOUNT is a 250-element array in MYPROG.

This command adds a breakpoint to statement 100 in MYPROG. When MYPROG is started, the program stops processing at statement 100, and the value of the 200th element of the AMOUNT array is shown. If AMOUNT had been specified without a subscript, all of the array elements would have been shown.


Example 3: Program Stops After Processing Statement 10 Times

ADDBKP STMT(10) SKIP(1000)

This command causes the default program to stop when statement 10 is processed 1000 times (the breakpoint is skipped 1000 times).


Example 4: Program Stops After Processing Multiple Statements

ADDBKP STMT(10 20 30) SKIP(50)

This command causes the default program to stop when statements 10, 20, and 30 are processed 50 times.


Example 5: Conditional Breakpoint

ADDBKP STMT(10) PGMVAR(X) BKPCOND(PGMVAR1 *EQ 5)

This command stops the default program at statement 10 when variable X is equal to five.


Example 6: Conditional Breakpoint

ADDBKP STMT(20) PGMVAR((S1) (S2)) SKIP(100)
BKPCOND(*PGMVAR1 *CT *PGMVAR2)

This command stops after statement 20 has been processed 100 times, and then only if the character string S2 occurs in the character string S1.