239 lines
11 KiB
HTML
239 lines
11 KiB
HTML
|
|
||
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<title>Change Program Variable (CHGPGMVAR)</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="CHGPGMVAR.Top_Of_Page"></a>
|
||
|
<h2>Change Program Variable (CHGPGMVAR)</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="#CHGPGMVAR.PARAMETERS.TABLE">Parameters</a><br>
|
||
|
<a href="#CHGPGMVAR.COMMAND.EXAMPLES">Examples</a><br>
|
||
|
<a href="#CHGPGMVAR.ERROR.MESSAGES">Error messages</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div> <a name="CHGPGMVAR"></a>
|
||
|
<p>The Change Program Variable (CHGPGMVAR) command changes the value of a variable in a program being debugged. Only string (character or bit) and numeric variables can be changed using this command. A portion of a character string or bit string can be changed; the length of the data to be changed is the length of the data specified on the <b>New value (VALUE)</b> parameter.
|
||
|
</p>
|
||
|
<p>
|
||
|
<b>Note: </b>Depending on where the variable is allocated, the duration of a change varies. For a variable in machine-interface (MI) static storage, the change lasts while the program is active. For an automatic variable, the change lasts until the call of the program is ended. Static variables are allocated either in MI static storage or in spaces controlled by language-dependent rules.
|
||
|
</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 change variables in a bound program.
|
||
|
</li>
|
||
|
<li>You cannot use this command to change variables that are write-protected or within the system domain, unless the user has service (*SERVICE) special authority.
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
|
||
|
<div>
|
||
|
<h3><a name="CHGPGMVAR.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="#CHGPGMVAR.PGMVAR"><b>PGMVAR</b></a></td>
|
||
|
<td valign="top">Program variables</td>
|
||
|
<td valign="top"><i>Element list</i></td>
|
||
|
<td valign="top" rowspan="3">Required, Positional 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top">Element 1: Program variable</td>
|
||
|
<td valign="top">
|
||
|
<i>Character value</i></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="#CHGPGMVAR.VALUE"><b>VALUE</b></a></td>
|
||
|
<td valign="top">New value</td>
|
||
|
<td valign="top"><i>Not restricted</i></td>
|
||
|
<td valign="top">Required, Positional 2</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top"><a href="#CHGPGMVAR.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="#CHGPGMVAR.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="#CHGPGMVAR.RCRLVL"><b>RCRLVL</b></a></td>
|
||
|
<td valign="top">Recursion level</td>
|
||
|
<td valign="top"><i>Integer</i>, <b><u>*LAST</u></b></td>
|
||
|
<td valign="top">Optional</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<div> <a name="CHGPGMVAR.PGMVAR"></a>
|
||
|
<h3>Program variables (PGMVAR)</h3>
|
||
|
<p>Specifies the program variable to be changed in a high-level language (HLL) or machine instruction (MI) program.
|
||
|
</p>
|
||
|
<p>This is a required parameter.
|
||
|
</p>
|
||
|
<p><b>Element 1: Program variable</b>
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><i>character-value</i></b></dt>
|
||
|
<dd>Specify the name of the program variable to be changed. If the 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, 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, 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 name of a basing pointer variable. In some languages, the program variable may be based on a pointer variable. This set of values allows you to explicitly specify as many as 5 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, 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="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<div> <a name="CHGPGMVAR.VALUE"></a>
|
||
|
<h3>New value (VALUE)</h3>
|
||
|
<p>Specifies the new value for the program variable. Rules for specifying values depend on the variable type.
|
||
|
</p>
|
||
|
<p>This is a required parameter.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<div> <a name="CHGPGMVAR.PGM"></a>
|
||
|
<h3>Program (PGM)</h3>
|
||
|
<p>Specifies the name of the program that contains the program variable whose value is to change.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><u>*DFTPGM</u></b></dt>
|
||
|
<dd>The program previously specified as the default program contains the variable to be changed.
|
||
|
</dd>
|
||
|
<dt><b><i>name</i></b></dt>
|
||
|
<dd>Specify the name of the program that contains the variable to change. The same name must already have been specified on the Start Debug (STRDBG) or Add Program (ADDPGM) command.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<div> <a name="CHGPGMVAR.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 to change. 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 first position of the program variable is the starting position in the string to change.
|
||
|
</dd>
|
||
|
<dt><b><i>integer</i></b></dt>
|
||
|
<dd>Specify the position number in the program variable that specifies the first position to change in the string. The starting position number must not be greater than the length of the string, except that a value of <b>1</b> for the START parameter is allowed if the maximum length for a string is zero. The length determined by the <b>New value (VALUE)</b> parameter, plus the value supplied for the START parameter minus one, must not be greater than the maximum string length.
|
||
|
<p>Varying length strings have rules affecting the validity and meaning of the START parameter.
|
||
|
</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<div> <a name="CHGPGMVAR.RCRLVL"></a>
|
||
|
<h3>Recursion level (RCRLVL)</h3>
|
||
|
<p>Specifies which recursion level of the program contains the variable whose value is to be changed. Changes made to static variables automatically affect all recursion levels. Recursion level 1 is the first (or earliest) call of the program, recursion level 2 is the second call of the program, and so on to the last (most recent) recursion level in the stack. For example, if program A calls program B, then program B calls program A, a new recursion level of program A is formed. If the first call of program A contains the variable to be changed, a value of 1 must be specified for the <b>Recursion level (RCRLVL)</b> parameter. Some high-level languages also allow recursive procedures. For these programs, refer to the appropriate high-level language manual for more information.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><u>*LAST</u></b></dt>
|
||
|
<dd>The last (most recent) call of the specified program contains the variable to be changed.
|
||
|
</dd>
|
||
|
<dt><b><i>integer</i></b></dt>
|
||
|
<dd>Specify the recursion level of the program that contains the variable to be changed.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="CHGPGMVAR.COMMAND.EXAMPLES">Examples</a> </h3>
|
||
|
<p><b>Example 1: Changing the Program Variable</b>
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
DCL VAR(&AMT) TYPE(*DEC) LEN(5 2)
|
||
|
:
|
||
|
CHGPGMVAR PGMVAR('&AMT') VALUE(16.2)
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>The first command, which is used in a CL program, declares the CL variable &AMT as a five-position decimal value having a 3-digit integer and a 2-digit fraction. The Change Program Variable (CHGPGMVAR) command is used to change the value of &AMT to 16.20. If VALUE is coded as 16 or 16.00, the value accepted is 16.00; if -16 is coded, the value accepted is -16.00. However, if 1600 is coded, an error occurs because the system assumes that, if no decimal point is coded, it is always on the right of the last digit coded.
|
||
|
</p>
|
||
|
<p><b>Example 2: Changing a Value in a Specific Position</b>
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
CHGPGMVAR PGMVAR(PARTNO) VALUE('56') START(4)
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>This command changes, starting in position 4, the program variable PARTNO to '56'.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="CHGPGMVAR.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="#CHGPGMVAR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|