CL Command Reference - ADDTRC
CL Command List > ADDTRC Reference
Description:
The Add Trace (ADDTRC) command specifies which program statements in a program to trace in debug mode. Up to five ranges of high-level language (HLL) statements or machine instructions can be traced during the processing of a program through one or more ADDTRC commands, and up to 10 program variables can be recorded or monitored for change in each specified statement range. A separate ADDTRC command is required for each unique variable associated with a statement range. When the specified program being traced is run, the system records the sequence in which the traced statements are processed and optionally records the value of the variables associated with the trace each time a traced statement is processed. After a trace has been completed, you can display this information using the Display Trace Data (DSPTRCDTA) command.
All of the trace ranges specified in a program are active at the same time. If both an HLL statement identifier and a machine instruction number are used to specify a given trace range, the trace range is treated as an HLL trace range. That is, in addition to tracing the machine instruction number specified, the system traces the HLL statement identifiers between that machine instruction number and the specified HLL statement identifier.
Restrictions:
. You can use this command only in debug mode. To start debug mode, refer to the Start Debug (STRDBG) command.
. You cannot use this command if you are servicing another job, and that job is on a job queue, or is being held, suspended, or ended.
. You cannot use this command to trace bound programs.
Examples:
ADDTRC STMT((100 120) (150 200))
PGMVAR(¡¯&CTR¡¯ ¡¯&BRCTR¡¯ ¡¯&SAM¡¯)
This command traces program statements in the default program between the ranges of statements 100 through 120 and 150 through 200. Also, whenever the values of any of the program variables &CTR, &BRCTR, and &SAM are changed by one of the traced statements within those ranges, the values of all three are recorded before the traced statement is processed. When all of the traced statements have been processed, or when a breakpoint is reached, the Display Trace Data (DSPTRCDTA) command can be used to show the trace data collected.