ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/adtrc.htm

211 lines
11 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="task" />
<meta name="DC.Title" content="Add traces to programs" />
<meta name="abstract" content="Adding a trace consists of specifying what statements are to be traced and, if you want, the names of program variables." />
<meta name="description" content="Adding a trace consists of specifying what statements are to be traced and, if you want, the names of program variables." />
<meta name="DC.subject" content="see='breakpoint'.trace, command, CL, STRDBG (Start Debug), Start Debug (STRDBG), debug, starting, CLRTRCDTA (Clear Trace Data) command, Clear Trace Data (CLRTRCDTA) command, command, CL, CLRTRCDTA (Clear Trace Data), Clear Trace Data (CLRTRCDTA), trace data, clearing, number of, number of statement ranges for, statement ranges for trace, ADDTRC (Add Trace) command, Add Trace (ADDTRC) command, ADDTRC (Add Trace), Add Trace (ADDTRC), Add Trace (ADDTRC) command, example, displaying, display, trace data, Clear Trace Data (CLRTRCDTA) command, CLRTRCDTA (Clear Trace Data), Clear Trace Data (CLRTRCDTA), DSPTRCDTA (Display Trace Data) command, Display Trace Data (DSPTRCDTA) command, DSPTRCDTA (Display Trace Data), Display Trace Data (DSPTRCDTA), instruction, stepping" />
<meta name="keywords" content="see='breakpoint'.trace, command, CL, STRDBG (Start Debug), Start Debug (STRDBG), debug, starting, CLRTRCDTA (Clear Trace Data) command, Clear Trace Data (CLRTRCDTA) command, command, CL, CLRTRCDTA (Clear Trace Data), Clear Trace Data (CLRTRCDTA), trace data, clearing, number of, number of statement ranges for, statement ranges for trace, ADDTRC (Add Trace) command, Add Trace (ADDTRC) command, ADDTRC (Add Trace), Add Trace (ADDTRC), Add Trace (ADDTRC) command, example, displaying, display, trace data, Clear Trace Data (CLRTRCDTA) command, CLRTRCDTA (Clear Trace Data), Clear Trace Data (CLRTRCDTA), DSPTRCDTA (Display Trace Data) command, Display Trace Data (DSPTRCDTA) command, DSPTRCDTA (Display Trace Data), Display Trace Data (DSPTRCDTA), instruction, stepping" />
<meta name="DC.Relation" scheme="URI" content="trace.htm" />
<meta name="DC.Relation" scheme="URI" content="dbgmi.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/chgdbg.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/strdbg.htm" />
<meta name="DC.Relation" scheme="URI" content="../clfinder/finder.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="adtrc" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Add traces to programs</title>
</head>
<body id="adtrc"><a name="adtrc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Add traces to programs</h1>
<div><p>Adding a trace consists of specifying what statements are to be
traced and, if you want, the names of program variables. </p>
<div class="section"> <p>Before a traced statement processes, the value of the variable
is recorded. Also, you can specify that the values of the variables are to
be recorded only if they have changed from the last time a traced statement
was processed. These variables can be displayed in character format or hexadecimal
format.</p>
<p>To specify which statements are to be traced, you can specify:
</p>
<ul><li>The statement identifier at which the trace is to start and the statement
identifier at which the trace is to stop</li>
<li>That all statements in the program are to be traced</li>
<li>A single statement identifier of a statement to be traced</li>
</ul>
<p>On the <span class="cmdname">Start Debug (STRDBG)</span> or <span class="cmdname">Change
Debug (CHGDBG)</span> command, you can specify how many statement traces
can be recorded for a job and what action the system should take when the
maximum is reached. When the maximum is reached, the system performs one
of the following actions (depending on what you specify): </p>
<ul><li>For an interactive job, either of the following can be done: <ul><li>Stop the trace (*STOPTRC). Control is given to you (a breakpoint occurs),
and you can remove some of the trace definitions (<span class="cmdname">Remove Trace (RMVTRC) </span>command),
clear the trace data (<span class="cmdname">Clear Trace Data (CLRTRCDTA)</span> command),
or change the maximum (MAXTRC parameter on the <span class="cmdname">Change Debug (CHGDBG)</span> command).</li>
<li>Continue the trace (*WRAP). Previously recorded trace data is overlaid
with trace data recorded after this point.</li>
</ul>
</li>
<li>For a batch job, either of the following can be done: <ul><li>Stop the trace (*STOPTRC). The trace definitions are removed and the program
continues processing.</li>
<li>Continue the trace (*WRAP). Previously recorded trace data is overlaid
with trace data recorded after this point.</li>
</ul>
</li>
</ul>
<p>You can change the maximum and the default action any time during
the debug job using the <span class="cmdname">Change Debug (CHGDBG)</span> command.
However, the change does not affect traces that have already been recorded.</p>
<p>You
can only specify a total of five statement ranges for a single program at
any one time, which is a total taken from all the <span class="cmdname">Add Trace (ADDTRC)</span> commands
for the program. In addition, only 10 variables can be specified for each
statement range.</p>
<p>In high-level language programs, different statements
and labels may be mapped to the same internal instruction. This happens when
there are several inoperable statements (such as DO, END) following one another
in a program. You can use the IRP list to determine which statements or labels
are mapped to the same instruction.</p>
<p>When you specify CL variables, you
must enclose the &amp; and the variable name in single apostrophes. For example:
</p>
<pre>ADDTRC PGMVAR('&amp;IN01')</pre>
<p>When you specify a statement range, the source statement number
for the stop statement is ordinarily larger than the number for the start
statement. Tracing, however, is performed with machine interface (MI) instructions,
and some compilers (notably RPG/400<sup>®</sup>) generate programs in which the order of
MI instructions is not the same as the order of the source statements. Therefore,
in some cases, the MI number of the stop statement may not be larger than
the MI number of the start statement, and you will receive message CPF1982.</p>
<p>When
you receive this message, you should do one of the following: </p>
<ul><li>Trace all statements in the program.</li>
<li>Restrict a statement range to one specification.</li>
<li>Use MI instruction numbers gotten from an intermediate representation
of a program (IRP) list of the program.</li>
</ul>
<p>The following <span class="cmdname">Add Trace (ADDTRC)</span> command adds a
trace to the program CUS310. CUS310 is the default program, so it does not
have to be specified. The value of the variable &amp;TOTBAL is recorded only
if its value changes between the times each traced statement is processed.
</p>
<pre>ADDTRC STMT((900 2700)) PGMVAR('&amp;TOTBAL') OUTVAR(*CHG)</pre>
<p>The following displays result from this trace and are displayed
using the <span class="cmdname">Display Trace Data (DSPTRCDTA)</span> command. Note
that column headers are not supplied for all displays.</p>
<pre class="screen"> Display Trace Data
Statement/
Program Instruction Recursion level
Sequence number
CUS310 900 1
1
Start position . . . . . . . . . . . . : 1
Length . . . . . . . . . . . . . . . . : *DCL
Format . . . . . . . . . . . . . . . . : *CHAR
Variable . . . . . . . . . . . . . . . : &amp;TOTBAL
Type . . . . . . . . . . . . . . . . : PACKED
Length . . . . . . . . . . . . . . . : 5 2
' .00'
Statement/
Program Instruction Recursion level
Sequence number
CUS310 1000 1
2
CUS310 1100 1
3 +
Press Enter to continue.
F3=Exit F12=Cancel
</pre>
<pre class="screen"> Display Trace Data
Start position . . . . . . . . . . . . : 1
Length . . . . . . . . . . . . . . . . : *DCL
Format . . . . . . . . . . . . . . . . : *CHAR
*Variable . . . . . . . . . . . . . . . : &amp;TOTBAL
Type . . . . . . . . . . . . . . . . : PACKED
Length . . . . . . . . . . . . . . . : 5 2
' 1.00'
Statement/
Program Instruction Recursion level
Sequence number
CUS310 1600 1
4
CUS310 1700 1
5
CUS310 2100 1
6
CUS310 2200 1
7
CUS310 2600 1
8 +
Press Enter to continue.
F3=Exit F12=Cancel
</pre>
<pre class="screen"> Display Trace Data
CUS310 2700 1
9
Start position . . . . . . . . . . . . : 1
Length . . . . . . . . . . . . . . . . : *DCL
Format . . . . . . . . . . . . . . . . : *CHAR
*Variable . . . . . . . . . . . . . . . : &amp;TOTBAL
Type . . . . . . . . . . . . . . . . : PACKED
Length . . . . . . . . . . . . . . . : 5 2
' 2.00'
Press Enter to continue.
F3=Exit F12=Cancel
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="trace.htm" title="A trace is the process of recording the sequence in which the statements in a program are processed.">Use traces</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="dbgmi.htm" title="You can debug your programs at the machine interface (MI) level.">Debug at the machine interface level</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../cl/chgdbg.htm">Change Debug (CHGDBG) command</a></div>
<div><a href="../cl/strdbg.htm">Start Debug (STRDBG) command</a></div>
<div><a href="../clfinder/finder.htm">CL command finder</a></div>
</div>
</div>
</body>
</html>