ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/do.htm

84 lines
3.0 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 Group (DO)</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="DO.Top_Of_Page"></a>
<h2>Do Group (DO)</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="#DO.PARAMETERS.TABLE">Parameters</a><br>
<a href="#DO.COMMAND.EXAMPLES">Examples</a><br>
<a href="#DO.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="DO"></a>
<p>The Do (DO) command allows you to group commands within a CL procedure; it is used with the ENDDO command to identify a group of commands that are processed together as a group. Usually, the DO command specifies the starting of a group of commands that are processed as a result of a decision made by the processing of an IF command. However, the DO command does not have to be associated with an IF command. When used with an IF command, the DO command can be either the true part of the decision (that is, the value of the THEN parameter of the IF command), or the false part of a decision (on the ELSE command). Every Do group must be ended by the ENDDO command. Do groups can be nested within other Do groups, but each group must have an ENDDO command to end its level of nesting.
</p>
<p><b>Restrictions:</b> This command is valid only within a CL procedure.
</p>
<p>There are no parameters for this command.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#DO.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="DO.PARAMETERS.TABLE">Parameters</a></h3>None<br>
<table width="100%">
<tr><td align="right"><a href="#DO.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<hr size="2" width="100%">
<div><h3><a name="DO.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Processing a Group of Commands Unconditionally</b>
</p>
<p>
<pre>
DO
: (group of CL commands)
ENDDO
</pre>
</p>
<p>The commands between the DO and ENDDO commands are processed once, as a group of commands.
</p>
<p><b>Example 2: Processing a Group of Commands Conditionally</b>
</p>
<p>
<pre>
IF &amp;SWITCH DO
: (group of CL commands)
ENDDO
</pre>
</p>
<p>The commands between the DO and ENDDO commands are processed if the value in the logical variable &amp;SWITCH is '1'. If &amp;SWITCH is not '1', then control passes immediately to the next command following the ENDDO command.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#DO.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="DO.ERROR.MESSAGES">Error messages</a> </h3>
<p>None
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#DO.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>