Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
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.
Restrictions:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
STMT | Statement identifier | Values (up to 10 repetitions): Character value | Required, Positional 1 |
PGMVAR | Program variables | Single values: *NONE Other values (up to 10 repetitions): Element list |
Optional, Positional 2 |
Element 1: Program variable | Character value, *CHAR | ||
Element 2: Basing pointer variable | Values (up to 5 repetitions): Character value | ||
OUTFMT | Output format | *CHAR, *HEX | Optional, Positional 5 |
PGM | Program | Name, *DFTPGM | Optional |
START | Char output start position | Integer, 1 | Optional, Positional 3 |
LEN | Characters to display | Integer, *DCL | Optional, Positional 4 |
SKIP | Skip value | Integer, 0 | Optional |
BKPCOND | Breakpoint condition | Single values: *NONE Other values: Element list |
Optional |
Element 1: Variable | *PGMVAR1, *PGMVAR2, *PGMVAR3, *PGMVAR4, *PGMVAR5, *PGMVAR6, *PGMVAR7, *PGMVAR8, *PGMVAR9, *PGMVAR10 | ||
Element 2: Operator | *EQ, *GT, *LT, *NE, *GE, *NL, *LE, *NG, *CT | ||
Element 3: Compare value or variable | Character value | ||
BKPPGM | Breakpoint program to call | Single values: *NONE Other values: Qualified object name |
Optional |
Qualifier 1: Breakpoint program to call | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB |
Top |
Specifies the statement identifiers of one to ten statements or machine instructions in the program at which breakpoints are set. When run, the program breaks before processing a statement specified as a breakpoint.
This is a required parameter.
The list can contain a maximum of 10 identifiers (statement numbers, program labels, or machine instruction numbers) that are valid for the program specified by the PGM parameter. At least one identifier is needed. If a machine instruction number is specified, a slash must be placed in front of the number and both the slash and the number must be enclosed in apostrophes.
In high-level language programs, different statements, different labels, or both can be mapped to the same internal instruction. This happens when there are several statements that do not operate on variables directly (such as DO, END, and comments) following one another in a program. To determine which statements can be mapped to the same instruction, the intermediate representation of a program listing can be used.
Because different statements can be mapped to the same instruction, adding a breakpoint can redefine a previous breakpoint that was added for a different statement. When this occurs, the new breakpoint replaces the previously added breakpoint.
Top |
Specifies the names of up to ten program variables shown that are in a high-level language or machine instruction program. The name and the value of each program variable is shown when any of the breakpoints specified on the Statement identifier (STMT) parameter are reached. When run, the program stops before processing a statement specified as a breakpoint.
Note: In some high-level languages such as RPG, variables that are declared but not referred to in the program cannot be specified on the PGMVAR parameter.
Single values
Other values (up to 10 repetitions)
Element 1: Program variable
If the program variable is an array, the subscripts representing the element in the array can be specified. If an array name is specified without any subscripts, all of the array elements are recorded. A single-dimensional cross-section can also be specified. Up to 132 characters may be specified for this program variable entry. This includes any qualifiers, subscripts, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, a machine-interface object-definition-table-vector (MI ODV) number, asterisk (single-dimensional cross-section), or a numeric variable name can be specified for a subscript. For more information on testing and debugging at machine interface level and on the program variable value, refer to the CL information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Element 2: Basing pointer variable
If the basing pointer is an array, the subscripts representing an element in the array must be specified. Up to 132 characters can be specified for a basing pointer name. This includes any qualification, subscripts, embedded blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, a machine-interface object-definition-table-vector (MI ODV) number, or a numeric variable name can be specified for a subscript.
For more information, refer to "Parameter values used for testing and debugging" in "CL concepts and reference" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
Top |
Specifies the format used to show the variables.
Top |
Specifies the program to which the breakpoints are added.
Top |
Specifies, for string variables only, the starting position in the string from which its value is shown when the breakpoint is reached. If more than one string variable is specified for the Program variables (PGMVAR) parameter, the same starting position value is used for each one. For a bit string, the value specifies the starting bit position, and for a character string, the value specifies the starting character position.
For conditional breakpoints, the Char output start position (START) parameter also specifies the starting point in the string where the comparison is made.
The value supplied for the START parameter must not be larger than the maximum string length for any variable specified, except that a value of 1 for the START parameter is allowed if the maximum length for a string is zero. The value supplied for the LEN parameter plus the value supplied for the START parameter minus one, must not be greater than the maximum string length. These checks are made for each string variable specified for the PGMVAR parameter.
Top |
Specifies, for string variables only, the length of the string shown when the breakpoint is reached, starting at the position specified by the value supplied for the Char output start position (START) parameter. If more than one string variable is specified by the value supplied for the Program variables (PGMVAR) parameter, the same value is used for each one. For a bit string, the value specifies the number of bits shown, and for a character string, the value specifies the number of characters shown.
For conditional breakpoints, the Characters to display (LEN) parameter also specifies the length of the string where the comparison is made.
Top |
Specifies the number of times the statement or statements on the Statement identifier (STMT) parameter must be processed before the program is stopped.
Top |
Specifies a condition, defined by an expression, that must be true before the program is stopped. The expression is tested before any statement on the Statement identifier (STMT) parameter is processed. If the expression is false, the breakpoint does not stop the program. If the expression is true, the program is stopped.
Note: The *CT operator compares whether one character string contains one or more occurrences of another character string. This comparison is for an exact match, and it is case sensitive.
If another program variable is specified, it is compared with the first variable. The variables must be of the same type. If the variables are numeric, they must both be floating point or not floating point. For example, a packed number may not be compared with a floating point number.
When comparing two non-floating point variables, or a non-floating point variable and a constant, the total number of digits needed to represent them must not exceed 31. For example, a PACKED(24,2) and a PACKED(24,20) cannot be compared. The first variable requires 22 digits to the left of the decimal point and two digits to the right. The second variable requires four digits to the left of the decimal and 20 digits to the right. To compare them requires a variable with 22 digits to the left of the decimal and 20 to the right. This exceeds the maximum number of allowed digits, 31.
When comparing two character strings, the shorter of the two will be padded on the right with blanks. When comparing two bit strings, they must both be of the same length. The Skip value (SKIP) parameter and the Breakpoint condition (BKPCOND) parameter may be used together. In this case, the breakpoint expression is not evaluated until the breakpoint has skipped the number of times specified by SKIP. After that, the breakpoint expression is evaluated and the program stops if the expression is true.
Top |
Specifies the name of the user-supplied program (if any) to call when a breakpoint is reached in the program specified by the Program (PGM) parameter. When the program specified by the BKPPGM parameter is called, it is passed four parameters that identify the program, the recursion level, the HLL statement identifier, and machine instruction number at which the breakpoint occurred. The parameters have the following format:
All the parameter values are left-adjusted and padded with blanks. When the called program returns, the program being debugged continues processing, starting with the statement that has the breakpoint on it.
Single values
Qualifier 1: Breakpoint program to call
Qualifier 2: Library
Top |
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.
Top |
Top |