87 lines
3.3 KiB
HTML
87 lines
3.3 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>Select (SELECT)</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="SELECT.Top_Of_Page"></a>
|
||
|
<h2>Select (SELECT)</h2>
|
||
|
<table width="100%">
|
||
|
<tr>
|
||
|
<td valign="top" align="left"><b>Where allowed to run: </b>
|
||
|
<ul><li>Batch program (*BPGM)</li>
|
||
|
<li>Interactive program (*IPGM)</li>
|
||
|
</ul><b>Threadsafe: </b>Yes
|
||
|
</td>
|
||
|
<td valign="top" align="right">
|
||
|
<a href="#SELECT.PARAMETERS.TABLE">Parameters</a><br>
|
||
|
<a href="#SELECT.COMMAND.EXAMPLES">Examples</a><br>
|
||
|
<a href="#SELECT.ERROR.MESSAGES">Error messages</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div> <a name="SELECT"></a>
|
||
|
<p>The Select (SELECT) command begins a control structure to allow conditional processing of command groups. The select group is ended with an End Select (ENDSELECT) command and must contain one or more When (WHEN) commands and optionally an otherwise (OTHERWISE) command.
|
||
|
</p>
|
||
|
<p>When a Select command is entered, the condition specified on the first When command is evaluated. If the condition is true, the command specified on the THEN parameter is run. After the command or group of commands is processed, control will pass to the matching ENDSELECT command. Only one WHEN or the optional OTHERWISE will be processed within a SELECT group.
|
||
|
</p>
|
||
|
<p>If the first WHEN condition is not true, subsequent WHEN commands are evaluated in the order specified. If no WHEN command condition is true, control will pass to the command specified on the OTHERWISE command, if OTHERWISE is specified.
|
||
|
</p>
|
||
|
<p><b>Restrictions:</b>
|
||
|
</p>
|
||
|
<ul>
|
||
|
<li>This command is valid only within a CL procedure.
|
||
|
</li>
|
||
|
<li>Up to 25 levels of nested SELECT commands are allowed.
|
||
|
</li>
|
||
|
</ul>
|
||
|
<p>There are no parameters for this command.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#SELECT.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
|
||
|
<div>
|
||
|
<h3><a name="SELECT.PARAMETERS.TABLE">Parameters</a></h3>None<br>
|
||
|
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#SELECT.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="SELECT.COMMAND.EXAMPLES">Examples</a> </h3>
|
||
|
<p>
|
||
|
<pre>
|
||
|
DCL VAR(&INT) TYPE(*INT) LEN(4)
|
||
|
:
|
||
|
SELECT
|
||
|
WHEN COND(&INT *LT 0) THEN(DO)
|
||
|
: (group of CL commands)
|
||
|
ENDDO
|
||
|
WHEN COND(&INT *EQ 0) /* Do nothing when zero */
|
||
|
WHEN COND(&INT *GT 0) THEN(CHGVAR &INT (&INT - 1)
|
||
|
ENDSELECT
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>The SELECT command group will evaluates the conditions of the WHEN commands in the order they are encountered. When a COND parameter results in a true value, the command specified on the THEN parameter is processed. After the command on the THEN parameter is processed, control passes to the command following the ENDSELECT command.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#SELECT.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="SELECT.ERROR.MESSAGES">Error messages</a> </h3>
|
||
|
<p>None
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#SELECT.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|