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

93 lines
5.5 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="Specify a list or qualified name using a variable" />
<meta name="abstract" content="Variables can be used to specify a list or qualified name." />
<meta name="description" content="Variables can be used to specify a list or qualified name." />
<meta name="DC.subject" content="qualified name, specifying, list, variable to specify, variable, specifying list, specifying qualified name, CHGLIBL (Change Library List) command, Change Library List (CHGLIBL) command, command, CL, CHGLIBL (Change Library List), Change Library List (CHGLIBL), library list, changing" />
<meta name="keywords" content="qualified name, specifying, list, variable to specify, variable, specifying list, specifying qualified name, CHGLIBL (Change Library List) command, Change Library List (CHGLIBL) command, command, CL, CHGLIBL (Change Library List), Change Library List (CHGLIBL), library list, changing" />
<meta name="DC.Relation" scheme="URI" content="workv.htm" />
<meta name="DC.Relation" scheme="URI" content="subst.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="usvar" />
<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>Specify a list or qualified name using a variable</title>
</head>
<body id="usvar"><a name="usvar"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Specify a list or qualified name using a variable</h1>
<div><p>Variables can be used to specify a list or qualified name.</p>
<div class="section"> <p>The value on a parameter may be a list. For example, the <span class="cmdname">Change
Library List (CHGLIBL)</span> command requires a list of libraries on the
LIBL parameter, each separated by blanks. The elements in this list can be
variables: </p>
<pre>CHGLIBL LIBL(&amp;LIB1 &amp;LIB2 &amp;LIB3)</pre>
<p>When variables are used to specify elements in a list, each
element must be declared separately: </p>
<pre>DCL VAR(&amp;LIB1) TYPE(*CHAR) LEN(10) VALUE(QTEMP)
DCL VAR(&amp;LIB2) TYPE(*CHAR) LEN(10) VALUE(QGPL)
DCL VAR(&amp;LIB3) TYPE(*CHAR) LEN(10) VALUE(DISTLIB)
CHGLIBL LIBL(&amp;LIB1 &amp;LIB2 &amp;LIB3)</pre>
<p>Variable elements cannot be specified in a list as a character
string:</p>
<div class="p"><strong>Incorrect:</strong> <pre>DCL VAR(&amp;LIBS) TYPE(*CHAR) LEN(20) +
VALUE('QTEMP QGPL DISTLIB')
CHGLIBL LIBL(&amp;LIBS)</pre>
</div>
<p>When presented as a single character string, the system
does not view the list as a list of separate elements, and an error will occur.</p>
<div class="p">You
can also use variables to specify a qualified name, if each qualifier is declared
as a separate variable: <pre>DCL VAR(&amp;PGM) TYPE(*CHAR) LEN(10)
DCL VAR(&amp;LIB) TYPE(*CHAR) LEN(10)
CHGVAR VAR(&amp;PGM) VALUE(MYPGM)
CHGVAR VAR(&amp;LIB) VALUE(MYLIB)
.
.
.
DLTPGM PGM(&amp;LIB/&amp;PGM)
ENDPGM</pre>
</div>
<p>In this example, the program and library name are declared
separately. The program and library name cannot be specified in one variable,
as in the following example:</p>
<p><strong>Incorrect:</strong> </p>
<pre>DCL VAR(&amp;PGM) TYPE(*CHAR) LEN(11)
CHGVAR VAR(&amp;PGM) VALUE('MYLIB/MYPGM')
DLTPGM PGM(&amp;PGM)</pre>
<p>Here again the value is viewed by the system as a single character
string, not as two objects (a library and an object). If a qualified name
must be handled as a single variable with a character string value, you can
use the built-in function %SUBSTRING and the *TCAT concatenation function
to assign object and library names to separate variables.</p>
</div>
</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 class="relref"><strong>Related reference</strong><br />
<div><a href="subst.htm" title="The substring built-in function (%SUBSTRING or%SST) produces a character string that is a subset of an existing character string and can only be used within a CL procedure.">%SUBSTRING built-in function</a></div>
</div>
</div>
</body>
</html>