<?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="reference" /> <meta name="DC.Title" content="Variable name" /> <meta name="abstract" content="A variable contains a data value that can be changed when a program is run. A variable name is the name of the variable containing the value." /> <meta name="description" content="A variable contains a data value that can be changed when a program is run. A variable name is the name of the variable containing the value." /> <meta name="DC.Relation" scheme="URI" content="rbam6parmvalues.htm" /> <meta name="DC.Relation" scheme="URI" content="rbam6uniquenamerules.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="rbam6variables" /> <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>Variable name</title> </head> <body id="rbam6variables"><a name="rbam6variables"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Variable name</h1> <div><p>A variable contains a data value that can be changed when a program is run. A variable name is the name of the variable containing the value. </p> <div class="section"><p>The variable is used in a command to pass the value that it contains at the time the command is run. The change in value can result if one of the following conditions occur: the value is received from a data area, a display device file field, or a message; the value is passed as a parameter; a <span class="cmdname">Change Variable (CHGVAR)</span> command is run in the program; or another program that is called changes the value before returning it.</p> <p>The types of variables are character string (includes names), decimal, logical, and integer. Decimal and logical values must match the type of value expected for the parameter. Character variables can specify any type of value. For example, if a decimal value is expected, it can be specified by a character variable as well as by a decimal variable. </p> <p>The variable name identifies a value to be used; the name points to where the actual data value is. Because CL variables are valid only in CL programs, they are often called <em>CL program variables</em> or, simply, CL variables. CL variable names must begin with an ampersand (&).</p> <p>CL variables can be used to specify values for almost all parameters of CL commands. When a CL variable is specified as a parameter value and the command containing it is run, the current value of the variable is used as the parameter value. That is, the variable value is passed as if the user had specified the value as a constant.</p> <p>Because it is generally true that CL variables can be used for most parameters of commands in CL programs, the command descriptions usually do not mention CL variables. For parameters that are restricted to constants only (such as in the DCL command), to CL variables only (such as all of the parameters of the <span class="cmdname">Retrieve Job Attributes (RTVJOBA)</span> command), or to specific types of variables (such as on the RTVJOBA or <span class="cmdname">Retrieve Message (RTVMSG)</span> command), the individual parameter descriptions specify those limitations. Otherwise, if the command is allowed in a CL program, CL variables can be used in place of a value, even with parameters that accept only predefined values. For example, a KEEP parameter having only predefined values of *YES and *NO can have a CL variable specified instead; its value can then be changed to *YES or *NO, depending on its value when the command is run.</p> <p>A CL variable must contain only one value; it may not contain a list of values separated by blanks.</p> <p>The value of any CL program variable can be defined as one of the following types:</p> <ul><li>Character: A character string that can contain a maximum of 9999 characters. The character string can be coded in quoted or unquoted form, but only the characters in the string itself are stored in the variable.</li> <li>Decimal: A packed decimal value that can contain a maximum of 15 digits, of which no more than nine can be decimal positions.</li> <li>Logical: A logical value of '1' or '0' that represents on/off, true/false, or yes/no.</li> <li>Integer: A two-byte or four-byte binary integer value that can be either signed (value may be positive or negative) or unsigned (value is always positive). </li> </ul> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. CL program variables</caption><thead align="left"><tr><th valign="top" width="22.110552763819097%" id="d0e59">If value is:</th> <th valign="top" width="77.88944723618091%" id="d0e61">CL variable can be declared as:</th> </tr> </thead> <tbody><tr><td valign="top" width="22.110552763819097%" headers="d0e59 ">Name</td> <td valign="top" width="77.88944723618091%" headers="d0e61 ">Character</td> </tr> <tr><td valign="top" width="22.110552763819097%" headers="d0e59 ">Date or time</td> <td valign="top" width="77.88944723618091%" headers="d0e61 ">Character</td> </tr> <tr><td valign="top" width="22.110552763819097%" headers="d0e59 ">Character string</td> <td valign="top" width="77.88944723618091%" headers="d0e61 ">Character</td> </tr> <tr><td valign="top" width="22.110552763819097%" headers="d0e59 ">Numeric</td> <td valign="top" width="77.88944723618091%" headers="d0e61 "> Decimal or integer or character </td> </tr> <tr><td valign="top" width="22.110552763819097%" headers="d0e59 ">Logical</td> <td valign="top" width="77.88944723618091%" headers="d0e61 ">Logical or character</td> </tr> </tbody> </table> </div> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rbam6parmvalues.htm" title="A parameter value is user-supplied information used during the running of a command.">Parameter values</a></div> </div> <div class="relconcepts"><strong>Related concepts</strong><br /> <div><a href="rbam6uniquenamerules.htm" title="This describes additional rules involving special characters for object naming.">Additional rules for unique names</a></div> </div> </div> </body> </html>