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

87 lines
5.3 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="reference" />
<meta name="DC.Title" content="DOWHILE command" />
<meta name="abstract" content="The DOWHILE command lets you process a group of commands zero or more times while the value of a logical expression is true." />
<meta name="description" content="The DOWHILE command lets you process a group of commands zero or more times while the value of a logical expression is true." />
<meta name="DC.subject" content="DOWHILE (Do While) command, Do While (DOWHILE) command, command, CL, DOWHILE (Do While), Do While (DOWHILE), example, DOWHILE command" />
<meta name="keywords" content="DOWHILE (Do While) command, Do While (DOWHILE) command, command, CL, DOWHILE (Do While), Do While (DOWHILE), example, DOWHILE command" />
<meta name="DC.Relation" scheme="URI" content="contp.htm" />
<meta name="DC.Relation" scheme="URI" content="expr.htm" />
<meta name="DC.Relation" scheme="URI" content="../clfinder/finder.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/dowhile.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="dowhilecmd" />
<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>DOWHILE command</title>
</head>
<body id="dowhilecmd"><a name="dowhilecmd"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">DOWHILE command</h1>
<div><p>The DOWHILE command lets you process a group of commands zero or
more times while the value of a logical expression is true. </p>
<div class="section"><p>The <span class="cmdname">Do While (DOWHILE)</span> command is used to state
a condition that, if true, specifies a command or group of commands in the
procedure to run. The group of commands is defined as those commands between
the <span class="cmdname">Do While (DOWHILE)</span> and the matching <span class="cmdname">End DO
(ENDDO)</span> command.</p>
<p>After the group of commands is processed,
the stated condition is evaluated. If the condition is false, the DOWHILE
group will be exited and processing will resume with the next command following
the associated ENDDO. If the condition is true, the group will continue processing
with the first command in the group. When the ENDDO command is reached, control
returns to the DOWHILE command to again evaluate the condition.</p>
<p>The
logical expression on the COND parameter may be a single logical variable
or constant, or it must describe a relationship between two or more operands;
the expression is then evaluated as true or false.</p>
<p>The following is
an example of conditional processing with a <span class="cmdname">Do While (DOWHILE)</span> command.</p>
<pre>DOWHILE (&amp;LGL)
.
.
.
IF (&amp;INT *EQ 2) (CHGVAR &amp;LGL '0')
ENDDO</pre>
<p>When the DOWHILE group is processed, the stated condition will
be evaluated. If the condition is true, the group of commands in the DOWHILE
group is processed. If the condition is false, processing continues with
the command following the associated ENDDO command.</p>
<p>If the value of &amp;LGL
is true, the commands in the DOWHILE group will be run until &amp;INT is equal
to 2 causing the &amp;LGL variable value to be set to false.</p>
<p>The <span class="cmdname">Leave
(LEAVE)</span> command may be used to exit the DOWHILE group and resume
processing following the ENDDO. The ITERATE command may be used to skip the
remaining commands in the group and evaluate the stated condition immediately.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="contp.htm" title="You can use commands to change the flow of logic within your CL procedure.">Control processing within a CL procedure</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="expr.htm" title="The logical operators *AND and *OR specify the relationship between operands in a logical expression. The logical operator *NOT is used to negate logical variables or constants.">*AND, *OR, and *NOT operators</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../clfinder/finder.htm">CL command finder</a></div>
<div><a href="../cl/dowhile.htm">Do While (DOWHILE) command</a></div>
</div>
</div>
</body>
</html>