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

93 lines
5.5 KiB
HTML
Raw 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="concept" />
<meta name="DC.Title" content="Variables replacing reserved or numeric parameter values" />
<meta name="abstract" content="Character variables can be used for some commands to represent a value on the command parameter." />
<meta name="description" content="Character variables can be used for some commands to represent a value on the command parameter." />
<meta name="DC.subject" content="parameter value, replacing, reserved parameter value, variable, replacing parameter value, numeric parameter value" />
<meta name="keywords" content="parameter value, replacing, reserved parameter value, variable, replacing parameter value, numeric parameter value" />
<meta name="DC.Relation" scheme="URI" content="workv.htm" />
<meta name="DC.Relation" scheme="URI" content="defcm.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="varrr" />
<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>Variables replacing reserved or numeric parameter values</title>
</head>
<body id="varrr"><a name="varrr"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Variables replacing reserved or numeric parameter values</h1>
<div><p>Character variables can be used for some commands to represent
a value on the command parameter.</p>
<p>Some CL commands allow both numeric or predefined (reserved) values on
certain parameters. Where this is true, you can also use character variables
to represent the value on the command parameter.</p>
<p>Each parameter on a command can accept only certain types of values. The
parameter may allow an integer, a character string, a reserved value, a variable
of a specified type, or some mixture of these, as values. Some types of values
are required for parameters. If the parameter allows numeric values (if the
value is defined in the command as *INT2, *INT4, *UINT2, *UINT4, or *DEC)
and also allows reserved values (a character string preceded by an asterisk),
you can use a variable as the value for the parameter. The variable must
be declared as TYPE(*CHAR) if you intend to use a reserved value.</p>
<p>For example, the <span class="cmdname">Change Output Queue (CHGOUTQ)</span> command
has a job separator (JOBSEP) parameter that can have a value of either a number
(0 through 9) or the predefined default, *SAME. Because both the number and
the predefined value are acceptable, you can also write a CL procedure that
substitutes a character variable for the JOBSEP value: </p>
<pre> PGM
DCL &amp;NRESP *CHAR LEN(6)
DCL &amp;SEP *CHAR LEN(4)
DCL &amp;FILNAM *CHAR LEN(10)
DCL &amp;FILLIB *CHAR LEN(10)
DCLF.....
.
.
.
LOOP: SNDRCVF.....
IF (&amp;SEP *EQ IGNR) GOTO END
ELSE IF (&amp;SEP *EQ NONE) CHGVAR &amp;NRESP '0'
ELSE IF (&amp;SEP *EQ NORM) CHGVAR &amp;NRESP '1'
ELSE IF (&amp;SEP *EQ SAME) CHGVAR &amp;NRESP '*SAME'
CHGOUTQ OUTQ(&amp;FILLIB/&amp;FILNAM) JOBSEP(&amp;NRESP)
GOTO LOOP
END: RETURN
ENDPGM</pre>
<p>In the preceding example, the display station user enters information on
a display describing the number of job separators desired for a specified
output queue. The variable &amp;NRESP is a character variable manipulating
numeric and predefined values (note the use of apostrophes). The JOBSEP parameter
on the <span class="cmdname">Change Output Queue (CHGOUTQ)</span> command will recognize
these values as if they had been entered as numeric or predefined values.
The DDS for the display file used in this program should use the VALUES keyword
to restrict the user responses to IGNR, NONE, NORM, or SAME.</p>
<p>If the parameter allows a numeric type of value (*INT2, *INT4, *UINT2,
*UINT4, or *DEC) and you do not intend to enter any reserved values (such
as *SAME), then you can use a decimal or integer variable in that parameter.</p>
<p>Another alternative for this function is to use the prompter
within CL procedures.</p>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="workv.htm" title="CL procedures consist of CL commands, and the commands themselves consist of the command statement, parameters, and parameter values.">Use variables</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="defcm.htm" title="This describes how you can define and create your own commands.">Define commands</a></div>
</div>
</div>
</body>
</html>