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

105 lines
5.4 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="task" />
<meta name="DC.Title" content="Use REXX for simple lists" />
<meta name="abstract" content="This describes the format in which elements in a simple list are passed when a command is run using REXX." />
<meta name="description" content="This describes the format in which elements in a simple list are passed when a command is run using REXX." />
<meta name="DC.subject" content="REXX procedure, using, for simple list, simple list, using REXX for, list, REXX, simple" />
<meta name="keywords" content="REXX procedure, using, for simple list, simple list, using REXX for, list, REXX, simple" />
<meta name="DC.Relation" scheme="URI" content="dslst.htm" />
<meta name="DC.Relation" scheme="URI" content="../books/sc415728.pdf" />
<meta name="DC.Relation" scheme="URI" content="../books/sc415729.pdf" />
<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="slrx" />
<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>Use REXX for simple lists</title>
</head>
<body id="slrx"><a name="slrx"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use REXX for simple lists</h1>
<div><p>This describes the format in which elements in a simple list are
passed when a command is run using REXX.</p>
<div class="section"> <div class="p">When the same command is run, the elements in a simple list are
passed to the REXX procedure in the argument string in the following format
where <samp class="codeph">valueN</samp> is the last value in the simple list.: <pre> . . . USER(value1 value2
. . . valueN) . . .</pre>
</div>
<p>For example, if two user names (BJONES and TBROWN) are
specified for the USER parameter, the following is passed: </p>
<pre> . . . USER(BJONES
TBROWN) . . .</pre>
<p>When a simple list is passed, only the number of elements specified
on the command are passed. Therefore, when the CPP processes a simple list,
it uses the number of elements passed to determine how many elements can be
processed.</p>
<p>The REXX example below produces the same result as the CL
procedure in <a href="crtcmdex.htm">Example: Create a command</a>:</p>
<div class="fignone" id="slrx__samecl"><a name="slrx__samecl"><!-- --></a><span class="figcap">Figure 1. REXX
Simple List Example</span><pre> .
.
.
PARSE ARG . 'USER(' user ')' .
.
.
CT = WORDS(user)
IF CT &gt; 0 THEN user1 = WORD(user,1) else user1 = '
IF CT &gt; 1 THEN user2 = WORD(user,2) else user2 = '
IF CT &gt; 2 THEN user3 = WORD(user,3) else user3 = '
IF CT &gt; 3 THEN user4 = WORD(user,4) else user4 = '
IF CT &gt; 4 THEN user5 = WORD(user,5) else user5 = '
IF CT &gt; 5 THEN
DO
/* If CT is greater than 5, the values passed
is greater than the program expects, and error
logic should be performed */
.
.
.
END
ELSE
DO
/* The correct number of values are passed
and the program can continue processing */
END
EXIT</pre>
</div>
<p>This same procedure can be used to process other lists in a REXX
program.</p>
<p>For a simple list, a single value such as *ALL or *NONE can
be entered on the command instead of the list. Single values are passed as
an individual value. Similarly, if no values are specified for a parameter,
the default value, if any is defined, is passed as the only value in the list.
For example, if the default value *ALL is used for the USER parameter, the
following is passed: </p>
<pre> . . . USER(*ALL) . . .</pre>
<p>If no default value is defined for an optional simple list
parameter, the following is passed: </p>
<pre> . . . USER() . . .</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dslst.htm" title="A simple list can accept one or more values of the type specified by the parameter.">Define a simple list</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../books/sc415728.pdf" target="_blank">REXX/400 Programmer's Guide PDF</a></div>
<div><a href="../books/sc415729.pdf" target="_blank">REXX/400 Reference PDF</a></div>
</div>
</div>
</body>
</html>