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

108 lines
3.5 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>Subroutine (SUBR)</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="SUBR.Top_Of_Page"></a>
<h2>Subroutine (SUBR)</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="#SUBR.PARAMETERS.TABLE">Parameters</a><br>
<a href="#SUBR.COMMAND.EXAMPLES">Examples</a><br>
<a href="#SUBR.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="SUBR"></a>
<p>The Subroutine (SUBR) command is used in a CL procedure, along with the End Subroutine (ENDSUBR) command, to delimit the group of commands that define a <b>subroutine</b>. The SUBR command defines the start of a subroutine. Subroutines may not be nested; therefore, an ENDSUBR command must end the current subroutine before the next SUBR command starts a new subroutine. A label specified on a SUBR command, or on a null command preceding the SUBR command, can be used as a target for a Go To (GOTO) command defined in the same subroutine. This GOTO command, when run, will pass control to the first executable statement in the subroutine.
</p>
<p><b>Restrictions:</b>
</p>
<ul>
<li>This command is valid only within a CL procedure.
</li>
<li>The subroutine must be defined within a procedure, and must be located at the end of the procedure.
</li>
</ul>
</div>
<table width="100%">
<tr><td align="right"><a href="#SUBR.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="SUBR.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="#SUBR.SUBR"><b>SUBR</b></a></td>
<td valign="top">Subroutine</td>
<td valign="top"><i>Simple name</i></td>
<td valign="top">Required, Positional 1</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#SUBR.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="SUBR.SUBR"></a>
<h3>Subroutine (SUBR)</h3>
<p>Specifies the subroutine name. This is the name that must be specified on a Call Subroutine (CALLSUBR) command.
</p>
<p>This is a required parameter.
</p>
<dl>
<dt><b><i>simple-name</i></b></dt>
<dd>Specify the name of the subroutine. A CL variable name cannot be used to specify the subroutine name.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#SUBR.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="SUBR.COMMAND.EXAMPLES">Examples</a> </h3>
<p>
<pre>
PGM
:
SUBR SUBR1
:
ENDSUBR
ENDPGM
</pre>
</p>
<p>This SUBR command defines the start of a subroutine named SUBR1.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#SUBR.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="SUBR.ERROR.MESSAGES">Error messages</a> </h3>
<p>None
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#SUBR.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>