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

92 lines
4.5 KiB
HTML

<?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="LEAVE command" />
<meta name="abstract" content="The Leave (LEAVE) command can be used to exit an active DOWHILE, DOUNTIL, or DOFOR group." />
<meta name="description" content="The Leave (LEAVE) command can be used to exit an active DOWHILE, DOUNTIL, or DOFOR group." />
<meta name="DC.subject" content="LEAVE (Leave) command, command, CL, LEAVE (Leave), example, LEAVE command" />
<meta name="keywords" content="LEAVE (Leave) command, command, CL, LEAVE (Leave), example, LEAVE command" />
<meta name="DC.Relation" scheme="URI" content="contp.htm" />
<meta name="DC.Relation" scheme="URI" content="../clfinder/finder.htm" />
<meta name="DC.Relation" scheme="URI" content="../cl/leave.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="leavecmd" />
<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>LEAVE command</title>
</head>
<body id="leavecmd"><a name="leavecmd"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">LEAVE command</h1>
<div><p>The <span class="cmdname">Leave (LEAVE)</span> command can be used to exit
an active DOWHILE, DOUNTIL, or DOFOR group. </p>
<div class="section"><p> It provides a structured manner to leave an active group without
resorting to the use of the <span class="cmdname">Goto (GOTO)</span> command. LEAVE
is not valid with simple <span class="cmdname">Do (DO)</span> command groups.</p>
<p>A <span class="cmdname">Leave
(LEAVE)</span> command without a label will leave the innermost active
DO group. Specifying a label allows the processing to break out of one or
more enclosing groups.</p>
<p>The following illustrates use of the <span class="cmdname">Leave
(LEAVE)</span> command:</p>
<pre>DO_1:
DO_2:DOWHILE &amp;LGL
DO_3: DOFOR &amp;INT FROM(0) TO(99)
.
.
.
IF (&amp;A *EQ 12) THEN(LEAVE DO_1)
.
. /* Not processed if &amp;A equals 12 */
.
IF (&amp;A *GT 12) LEAVE
.
. /* Not processed if &amp;A greater than 12 */
.
ENDDO
.
.
.
IF (&amp;A *LT 0) (LEAVE DO_1)
.
. /* Not processed if &amp;A less than zero */
.
ENDDO</pre>
<p>In this example, the labels DO_1 and DO_2 are associated with
the DOWHILE group. They can be specified on a LEAVE command appearing in
either the DOWHILE or DOFOR group. When &amp;A is equal to 12, the LEAVE
DO_1 command is run and processing continues with the CL command following
the second ENDDO.</p>
<p>If &amp;A is not equal to 12 but is greater than 12,
the DOFOR group is exited and processing continues with next command following
the first ENDDO.</p>
<p>When the third <span class="cmdname">If (IF)</span> command is
processed and &amp;A is less than zero, processing continues with the next
command following the first ENDDO.</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="relinfo"><strong>Related information</strong><br />
<div><a href="../clfinder/finder.htm">CL command finder</a></div>
<div><a href="../cl/leave.htm">Leave (LEAVE) command</a></div>
</div>
</div>
</body>
</html>