123 lines
4.3 KiB
HTML
123 lines
4.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>Do Until (DOUNTIL)</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="DOUNTIL.Top_Of_Page"></a>
|
||
|
<h2>Do Until (DOUNTIL)</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="#DOUNTIL.PARAMETERS.TABLE">Parameters</a><br>
|
||
|
<a href="#DOUNTIL.COMMAND.EXAMPLES">Examples</a><br>
|
||
|
<a href="#DOUNTIL.ERROR.MESSAGES">Error messages</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div> <a name="DOUNTIL"></a>
|
||
|
<p>The Do Until (DOUNTIL) command processes a group of CL commands one or more times. After the commands in the group have been processed, the logical condition is evaluated.
|
||
|
</p>
|
||
|
<p>If the logical expression is false (a logical 0), the commands in this Do Until group are processed again for as long as the expression continues to evaluate to false. If the logical expression evaluates to true (a logical 1), control passes to the next command following the associated ENDDO command.
|
||
|
</p>
|
||
|
<p><b>Restrictions:</b>
|
||
|
</p>
|
||
|
<ul>
|
||
|
<li>This command is valid only in CL procedures.
|
||
|
</li>
|
||
|
<li>Up to 25 levels of nested DO, DOWHILE, DOUNTIL and DOFOR commands are allowed.
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#DOUNTIL.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
|
||
|
<div>
|
||
|
<h3><a name="DOUNTIL.PARAMETERS.TABLE">Parameters</a></h3>
|
||
|
<table border="1" cellpadding="4" cellspacing="0">
|
||
|
<!-- col1="10" col2="15" col3="30" col4="10" -->
|
||
|
<tr>
|
||
|
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
|
||
|
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
|
||
|
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
|
||
|
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top"><a href="#DOUNTIL.COND"><b>COND</b></a></td>
|
||
|
<td valign="top">Condition</td>
|
||
|
<td valign="top"><i>Logical value</i></td>
|
||
|
<td valign="top">Required, Positional 1</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#DOUNTIL.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<div> <a name="DOUNTIL.COND"></a>
|
||
|
<h3>Condition (COND)</h3>
|
||
|
<p>Specifies the logical expression that is evaluated to determine a condition in the program and whether the loop is processed again. Refer to "Logical Expressions" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter for a description of logical expressions. Note that variables, constants, and the %SUBSTRING, %SWITCH, and %BINARY built-in functions can be used within the expression.
|
||
|
</p>
|
||
|
<p>This is a required parameter.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><i>logical-value</i></b></dt>
|
||
|
<dd>Specify the name of a CL logical variable or a logical expression.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#DOUNTIL.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="DOUNTIL.COMMAND.EXAMPLES">Examples</a> </h3>
|
||
|
<p><b>Example 1: DOUNTIL Command Group</b>
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
DCL VAR(&INT) TYPE(*INT) LEN(2) VALUE(10)
|
||
|
:
|
||
|
DOUNTIL COND(&INT *GT 100)
|
||
|
: (group of CL commands)
|
||
|
CHGVAR VAR(&INT) VALUE(&INT + &VAL)
|
||
|
ENDDO
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>The group of commands between the DOUNTIL and ENDDO will be processed until the value of &INT is greater than 100 when the ENDDO command is processed. The contents of the DOUNTIL group will be processed at least once regardless of the value of &INT at the beginning of the group.
|
||
|
</p>
|
||
|
<p><b>Example 2: DOUNTIL Forever Command Group</b>
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
DOUNTIL COND('0')
|
||
|
: (group of CL commands)
|
||
|
ENDDO
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>The group of commands between the DOUNTIL and ENDDO will be processed until either a LEAVE or GOTO command is encountered.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#DOUNTIL.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="DOUNTIL.ERROR.MESSAGES">Error messages</a> </h3>
|
||
|
<p>None
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#DOUNTIL.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|