ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/addtrc.htm

368 lines
21 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Add Trace (ADDTRC)</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body bgcolor="white">
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<a name="ADDTRC.Top_Of_Page"></a>
<h2>Add Trace (ADDTRC)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>No
</td>
<td valign="top" align="right">
<a href="#ADDTRC.PARAMETERS.TABLE">Parameters</a><br>
<a href="#ADDTRC.COMMAND.EXAMPLES">Examples</a><br>
<a href="#ADDTRC.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="ADDTRC"></a>
<p>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.
</p>
<p>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. More information on testing and debugging at the machine interface level is in the CL information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
</p>
<p><b>Restrictions:</b>
</p>
<ul>
<li>You can use this command only in debug mode. To start debug mode, refer to the Start Debug (STRDBG) command.
</li>
<li>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.
</li>
</ul>
<ul>
<li>You cannot use this command to trace bound programs.
</li>
</ul>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="ADDTRC.PARAMETERS.TABLE">Parameters</a></h3>
<table border="1" cellpadding="4" cellspacing="0">
<!-- col1="10" col2="15" col3="30" col4="10" -->
<tr>
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#ADDTRC.STMT"><b>STMT</b></a></td>
<td valign="top">Statements to trace</td>
<td valign="top">Single values: <b><u>*ALL</u></b>, *ALLINST<br>Other values (up to 5 repetitions): <i>Element list</i></td>
<td valign="top" rowspan="3">Optional, Positional 1</td>
</tr>
<tr>
<td valign="top">Element 1: Starting statement identifier</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top">Element 2: Ending statement identifier</td>
<td valign="top">
<i>Character value</i></td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#ADDTRC.PGMVAR"><b>PGMVAR</b></a></td>
<td valign="top">Program variables</td>
<td valign="top">Single values: <b><u>*NONE</u></b><br>Other values (up to 10 repetitions): <i>Element list</i></td>
<td valign="top" rowspan="3">Optional, Positional 2</td>
</tr>
<tr>
<td valign="top">Element 1: Program variable</td>
<td valign="top">
<i>Character value</i>, *CHAR</td>
</tr>
<tr>
<td valign="top">Element 2: Basing pointer variable</td>
<td valign="top">
Values (up to 5 repetitions): <i>Character value</i></td>
</tr>
<tr>
<td valign="top"><a href="#ADDTRC.OUTFMT"><b>OUTFMT</b></a></td>
<td valign="top">Output format</td>
<td valign="top"><b><u>*CHAR</u></b>, *HEX</td>
<td valign="top">Optional, Positional 5</td>
</tr>
<tr>
<td valign="top"><a href="#ADDTRC.PGM"><b>PGM</b></a></td>
<td valign="top">Program</td>
<td valign="top"><i>Name</i>, <b><u>*DFTPGM</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#ADDTRC.START"><b>START</b></a></td>
<td valign="top">Char output start position</td>
<td valign="top"><i>Integer</i>, <b><u>1</u></b></td>
<td valign="top">Optional, Positional 3</td>
</tr>
<tr>
<td valign="top"><a href="#ADDTRC.LEN"><b>LEN</b></a></td>
<td valign="top">Characters to display</td>
<td valign="top"><i>Integer</i>, <b><u>*DCL</u></b></td>
<td valign="top">Optional, Positional 4</td>
</tr>
<tr>
<td valign="top"><a href="#ADDTRC.OUTVAR"><b>OUTVAR</b></a></td>
<td valign="top">When output</td>
<td valign="top"><b><u>*CHG</u></b>, *ALWAYS</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#ADDTRC.TRCPGM"><b>TRCPGM</b></a></td>
<td valign="top">Trace handling program</td>
<td valign="top">Single values: <b><u>*NONE</u></b><br>Other values: <i>Qualified object name</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Trace handling program</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr></table>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="ADDTRC.STMT"></a>
<h3>Statements to trace (STMT)</h3>
<p>Specifies which program statements (or machine instructions) to trace in the program.
</p>
<dl>
<dt><b><u>*ALL</u></b></dt>
<dd>All statements in the specified high-level language program are traced.
</dd>
<dt><b>*ALLINST</b></dt>
<dd>All machine instructions in the specified program are traced.
</dd>
<dt><b><i>start-statement-identifier stop-statement-identifier</i></b></dt>
<dd>Specify 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. Each trace range begins with the specified starting statement, and all following statements are traced until the ending statement is reached. If only a starting statement identifier is specified for a range, the single statement specified is the only statement traced for that range. If machine instruction numbers are specified, a slash must be placed in front of the number, and both the slash and the number must be enclosed in apostrophes.
<p>In high-level language programs, different statements and/or labels 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, or comments) following one another in a program. To determine which statements (labels) can be mapped to the same instruction, the intermediate representation of a program listing can be used.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.PGMVAR"></a>
<h3>Program variables (PGMVAR)</h3>
<p>Specifies 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 <b>When output (OUTVAR)</b> parameter, the values can be recorded for every trace statement processed or only when a variable changes value. The program variables can be specified either by their high-level language names or by their machine-interface object-definition-table-vector (MI ODV) numbers.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No program variables have their values recorded during tracing.
</dd>
</dl>
<p><b>Other values (up to 10 repetitions)</b>
</p>
<p><b>Element 1: Program variable</b>
</p>
<dl>
<dt><b>*CHAR</b></dt>
<dd>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.
</dd>
<dt><b><i>character-value</i></b></dt>
<dd>Specify 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.
<p>If the program variable is an array, the subscripts representing the elements 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, blanks, parentheses, or commas. It does not include the enclosing apostrophes when special characters are used. An integer, MI ODV number, asterisk (single-dimensional cross-section), or a numeric variable name can be specified for a subscript.
</p>
<p>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.
</p>
</dd>
</dl>
<p><b>Element 2: Basing pointer variable</b>
</p>
<dl>
<dt><b><i>character-value</i></b></dt>
<dd>Specify 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. This set of values allows you to explicitly specify the basing pointers for the variable to be recorded. Each basing-pointer name must be enclosed in apostrophes if it contains special characters.
<p>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 qualifiers, subscripts, blanks, parentheses, and commas. It does not include the enclosing apostrophes when special characters are used. An integer, machine-interface object-definition-table-vector (MI ODV) number, or a numeric variable name can be specified for a subscript.
</p>
<p>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.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.OUTFMT"></a>
<h3>Output format (OUTFMT)</h3>
<p>Specifies the format to use for recording the variables.
</p>
<dl>
<dt><b><u>*CHAR</u></b></dt>
<dd>Variables are recorded in character form.
</dd>
<dt><b>*HEX</b></dt>
<dd>Variables are recorded in hexadecimal form.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.PGM"></a>
<h3>Program (PGM)</h3>
<p>Specifies the program that contains the specified statement identifiers or the machine instruction numbers to trace.
</p>
<dl>
<dt><b><u>*DFTPGM</u></b></dt>
<dd>The program previously specified as the default program contains the statements to trace.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the program that contains the statements to trace. The specified program must already be in debug mode.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.START"></a>
<h3>Char output start position (START)</h3>
<p>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 <b>Program variables (PGMVAR)</b> parameter, the same starting position value is used for each one. For a bit string, the value specifies the starting bit position. For a character string, the value specifies the starting character position.
</p>
<dl>
<dt><b><u>1</u></b></dt>
<dd>The variable is recorded from the first position on through the length specified for the <b>Characters to display (LEN)</b> parameter.
</dd>
<dt><b><i>integer</i></b></dt>
<dd>Specify the first position being recorded in the program variable.
<p>The value supplied for the <b>Char output start position (START)</b> parameter must not be larger than the maximum string length for any variable specified, except that a value of <b>1</b> 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.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.LEN"></a>
<h3>Characters to display (LEN)</h3>
<p>Specifies, for string variables only, the length of the string being recorded during the trace, starting at the position specified for the <b>Char output start position (START)</b> parameter. If more than one string variable is specified by the <b>Program variables (PGMVAR)</b> 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.
</p>
<dl>
<dt><b><u>*DCL</u></b></dt>
<dd>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 <b>Characters to display (LEN)</b> parameter is *DCL.
</dd>
<dt><b><i>integer</i></b></dt>
<dd>Specify 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.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.OUTVAR"></a>
<h3>When output (OUTVAR)</h3>
<p>Specifies 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 <b>Program variables (PGMVAR)</b> parameter.
</p>
<p>
<b>Note: </b>Within each range, the values of all the traced variables are always recorded the first time a statement in the range is processed. The value supplied for the OUTVAR parameter determines when the variables are recorded for all following statements in the range.
</p>
<dl>
<dt><b><u>*CHG</u></b></dt>
<dd>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). For example, if an array is specified and the upper boundary changes for the array, the array is considered to have changed.
<p>
<b>Note: </b>The value might not appear to have changed if it contains characters that cannot be shown (a value less than 40 hex). The variable is still recorded even though you cannot see the change from what is shown. If *HEX is specified for the <b>Output format (OUTFMT)</b> parameter, the changes can be observed in the traced data.
</p>
</dd>
<dt><b>*ALWAYS</b></dt>
<dd>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.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="ADDTRC.TRCPGM"></a>
<h3>Trace handling program (TRCPGM)</h3>
<p>Specifies the user-supplied program that is called when a statement being traced is reached in the program specified on the <b>Program (PGM)</b> parameter. The program with the traced statement passes informational parameters to the trace-handling program when it is called. These parameters identify the program name, the recursion level, the high-level language statement identifier, the machine instruction number at which the trace statement occurred, and a changed variable indicator. The parameters have the following formats:
</p>
<ol>
<li>Program name (10 bytes). Specifies the name of the program in which the traced statement was reached.
</li>
<li>Recursion level (5 bytes). Specifies the recursion level number of the program in which the traced statement was reached. This value is a 1- to 5-digit number padded on the right with blanks.
</li>
<li>Statement Identifier (10 bytes). Specifies the high-level language program statement identifier that was reached. If the traced statement does not correspond to a statement identifier, the parameter contains a slash (/) followed by a 4-digit hexadecimal machine instruction number.
</li>
<li>Instruction number (5 bytes). Specifies the machine instruction number that corresponds to the high-level language statement at which the traced statement was reached. No slash appears in front of the machine instruction number. The value consists of 1 to 4 hexadecimal characters representing the MI instruction number, followed by one or more blanks. If the program passes a machine instruction number on the third parameter, the values on the third and fourth parameters will be the same.
</li>
</ol>
<p>All the parameter values are left-justified and padded on the right with blanks. When control returns to the program with the traced statement, processing continues.
</p>
<p>When a trace-handling program is specified and OUTVAR(*CHG) is specified, the trace-handling program is called only if a program variable specified on the <b>Program variables (PGMVAR)</b> parameter is changed. No trace data is recorded.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>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.
</dd>
</dl>
<p><b>Qualifier 1: Trace handling program</b>
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify 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 <b>Program</b> (PGM) parameter. If the same program is specified for both the TRCPGM and PGM parameters, results can be unpredictable. After the program runs, control is returned to the interrupted program and processing continues.
</dd>
</dl>
<p><b>Qualifier 2: Library</b>
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library to be searched.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="ADDTRC.COMMAND.EXAMPLES">Examples</a> </h3>
<p>
<pre>
ADDTRC STMT((100 120) (150 200))
PGMVAR('&amp;CTR' '&amp;BRCTR' '&amp;SAM')
</pre>
</p>
<p>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 &amp;CTR, &amp;BRCTR, and &amp;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.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="ADDTRC.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPF1999</b></dt>
<dd>Errors occurred on command.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#ADDTRC.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>