Command reference / prog
ADDTRC
Add Trace
Selects statement or instruction ranges to trace for a program in debug mode. A program can have up to five trace ranges.
Allowed environments: *ALL.
Positional parameters: 5.
Parameters
STMT
Statements to trace
Select which program statements (or machine instructions) to trace in the program.
Suggested / special values:
*ALL, *ALLINST
*ALL- All statements in the specified high-level language program are traced.
*ALLINST- All machine instructions in the specified program are traced.
start-statement-identifier stop-statement-identifier- Enter the HLL statement identifiers (or machine instruction numbers) at which tracing starts and, optionally, the identifier at which tracing stops. A maximum of five trace ranges can be defined at the same time for any program in debug mode.
Elements in order
Starting statement identifier
Starting statement identifier
Ending statement identifier
Ending statement identifier
PGMVAR
Program variables
Sets the names of the variables whose values are recorded when a trace statement in a program is processed. Depending on the value supplied for the When output (OUTVAR) parameter, the values can be recorded for every trace statement processed or only when a variable changes value.
Suggested / special values:
*NONE
*NONE- No program variables have their values recorded during tracing.
*CHAR- This special value is specified instead of a variable name if a basing pointer is also specified. This special value displays a character view of a pointer to be shown without the use of a based variable.
character-value (program variable)- Enter the names of up to ten program variables whose values are recorded during tracing. If a variable name contains special characters, it must be enclosed in apostrophes.
character-value (basing pointer variable)- Enter the names of up to five basing pointers for each program variable specified for element 1 of this parameter. In some languages, the program variable may be based on a pointer variable.
Elements in order
Program variable
Program variable
Suggested / special values:
*CHAR
Basing pointer variable
Basing pointer variable
START
Char output start position
Specifies, for string variables only, the starting position in the string from which its value is recorded during tracing. 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.
1- The variable is recorded from the first position on through the length specified for the Characters to display (LEN) parameter.
integer- Enter the first position being recorded in the program variable.
LEN
Characters to display
Specifies, for string variables only, the length of the string being recorded during the trace, starting at the position specified for the Char output start position (START) parameter. If more than one string variable is specified by the Program variables (PGMVAR) parameter the same value is used for each one.
Suggested / special values:
*DCL
*DCL- The string variable is shown to the end of the string or for a value of 200 bytes, whichever is less. If the string variable has a maximum length of zero, the only allowable value for the Characters to display (LEN) parameter is *DCL.
integer- Enter the length of the data shown. The length (as well as the combination of values supplied for the START parameter and the LEN parameter must be no greater than the length of the shortest string specified by the PGMVAR parameter.
OUTFMT
Output format
Sets the format to use for recording the variables.
Allowed values:
*CHAR, *HEX
*CHAR- Variables are recorded in character form.
*HEX- Variables are recorded in hexadecimal form.
PGM
Program
Sets the program that contains the specified statement identifiers or the machine instruction numbers to trace.
Suggested / special values:
*DFTPGM
*DFTPGM- The program previously specified as the default program contains the statements to trace.
name- Enter the name of the program that contains the statements to trace. The specified program must already be in debug mode.
OUTVAR
When output
Controls whether the values of the program variables are recorded only when their values change, or whether they are recorded regardless of any of their values being changed. This parameter is ignored if *NONE is specified or assumed for the Program variables (PGMVAR) parameter. Note: Within each range, the values of all the traced variables are always recorded the first time a statement in the range is processed.
Allowed values:
*CHG, *ALWAYS
*CHG- The system records the values of all the program variables when one or more of the values have changed since the last trace point. A variable is considered changed not only when its value is changed, but also when any of the displayed attributes change (such as length, lower and upper boundaries, and subscript values).
*ALWAYS- The system records the values of the specified variables every time any of the specified trace statements are processed, whether or not any variable had its value changed.
TRCPGM
Trace handling program
Sets the user-supplied program that is called when a statement being traced is reached in the program specified on the Program (PGM) parameter. The program with the traced statement passes informational parameters to the trace-handling program when it is called.
Suggested / special values:
*NONE
*NONE- No trace-handling program is called when a traced point specified on this command is reached in a batch environment. The interrupted program continues processing.
name (trace handling program)- Enter the name of the user-supplied program to be called when a traced statement is reached during debugging in a batch environment. The program specified must not be the same as the program specified on the Program (PGM) parameter.
*LIBL- Look in the thread's library list.
*CURLIB- Look in the current library, falling back to QGPL.
name (library)- Enter the name of the library to be searched.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Trace handling program
Trace handling program
Library
Library
Suggested / special values:
*LIBL, *CURLIB
Examples
ADDTRC STMT((100 120) (150 200)) PGMVAR('&CTR' '&BRCTR' '&SAM')
Traces program statements in the default program between the ranges of statements 100 through 120 and 150 through 200.
Generated from os/cl/catalog/ADDTRC.json and os/cl/help/ADDTRC.json.