You can add a conditional breakpoint to a program that is being debugged using the Add Breakpoint (ADDBKP) command to specify the statement and condition.
If the condition is met, the system stops the program processing at the specified statement.
You may specify a skip value on the Add Breakpoint (ADDBKP) command. A skip value is a number that indicates how many times a statement should be processed before the system stops the program. For example, to stop a program at statement 1200 after the statement has been processed 100 times, enter the following command:
ADDBKP STMT(1200) SKIP(100)
If you specify multiple statements when the SKIP parameter is specified, each statement has a separate count. The following command causes your program to stop on statement 150 or 200, but only after the statement has processed 400 times:
ADDBKP STMT(150 200) SKIP(400)
If statement 150 has processed 400 times but statement 200 has processed only 300 times, then the program does not stop on statement 200.
If a statement has not processed as many times as was specified on the SKIP parameter, the Display Breakpoint (DSPBKP) command can be used to show how many times the statement was processed. To reset the SKIP count for a statement to zero, enter the breakpoint again for that statement.
You can specify a more general breakpoint condition on the Add Breakpoint (ADDBKP) command. This expression uses a program variable, an operator, and another variable or constant as the operands. For example, to stop a program at statement 1500 when variable &X is greater than 1000, enter the following command:
ADDBKP STMT(1500) PGMVAR('&X') BKPCOND(*PGMVAR1 *GT 1000)
The BKPCOND parameter requires three values:
The SKIP and BKPCOND parameters can be used together to specify a complex breakpoint condition. For example, to stop a program on statement 1000 after the statement has been processed 50 times and only when the character string &STR is TRUE, enter the following command:
ADDBKP STMT(1000) PGMVAR('&STR') SKIP(50) BKPCOND(*PGMVAR1 *EQ 'TRUE ')