124 lines
4.1 KiB
HTML
124 lines
4.1 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>End Subroutine (ENDSUBR)</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="ENDSUBR.Top_Of_Page"></a>
|
||
|
<h2>End Subroutine (ENDSUBR)</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="#ENDSUBR.PARAMETERS.TABLE">Parameters</a><br>
|
||
|
<a href="#ENDSUBR.COMMAND.EXAMPLES">Examples</a><br>
|
||
|
<a href="#ENDSUBR.ERROR.MESSAGES">Error messages</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div> <a name="ENDSUBR"></a>
|
||
|
<p>The End Subroutine (ENDSUBR) command specifies the end of a subroutine, and must be paired with a previous Subroutine (SUBR) command. When the ENDSUBR command is processed, control is returned to the command immediately following the Call Subroutine (CALLSUBR) command that called the subroutine. If a value is to be returned, such as an error code, the returned value must be able to be stored into a 4-byte signed integer CL variable. The <b>Return value (RTNVAL) </b> parameter can be a variable or constant. If no RTNVAL parameter is defined, the value will default to zero.
|
||
|
</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="#ENDSUBR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
|
||
|
<div>
|
||
|
<h3><a name="ENDSUBR.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="#ENDSUBR.RTNVAL"><b>RTNVAL</b></a></td>
|
||
|
<td valign="top">Return value</td>
|
||
|
<td valign="top"><i>Integer</i>, <b><u>0</u></b></td>
|
||
|
<td valign="top">Optional</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#ENDSUBR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<div> <a name="ENDSUBR.RTNVAL"></a>
|
||
|
<h3>Return value (RTNVAL)</h3>
|
||
|
<p>Specifies the value to be returned from the subroutine. This can be a variable or constant that can be stored in a 4-byte signed integer CL variable. If the Call Subroutine (CALLSUBR) command that called the subroutine specified a <b>CL variable for returned value</b>, the variable is set to this value.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><u>0</u></b></dt>
|
||
|
<dd>The subroutine returns a zero.
|
||
|
</dd>
|
||
|
<dt><b><i>integer-constant</i></b></dt>
|
||
|
<dd>Specify the constant integer value for the return value.
|
||
|
</dd>
|
||
|
<dt><b><i>CL-variable-name</i></b></dt>
|
||
|
<dd>Specify the name of the CL variable to contain the return value from the called subroutine. This must be a signed integer CL variable.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#ENDSUBR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="ENDSUBR.COMMAND.EXAMPLES">Examples</a> </h3>
|
||
|
<p>
|
||
|
<pre>
|
||
|
PGM
|
||
|
:
|
||
|
SUBR SUBR1
|
||
|
:
|
||
|
ENDSUBR
|
||
|
ENDPGM
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>This CL subroutine is identified by a SUBR command that contains the subroutine name, SUBR1, and is ended by the ENDSUBR command.
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
PGM
|
||
|
:
|
||
|
SUBR SUBR1
|
||
|
:
|
||
|
ENDSUBR RTNVAL(-1)
|
||
|
ENDPGM
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>This CL subroutine has an ENDSUBR command that returns a -1.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#ENDSUBR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="ENDSUBR.ERROR.MESSAGES">Error messages</a> </h3>
|
||
|
<p>None
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#ENDSUBR.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|