112 lines
3.9 KiB
HTML
112 lines
3.9 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>Return from Subroutine (RTNSUBR)</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="RTNSUBR.Top_Of_Page"></a>
|
|
<h2>Return from Subroutine (RTNSUBR)</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="#RTNSUBR.PARAMETERS.TABLE">Parameters</a><br>
|
|
<a href="#RTNSUBR.COMMAND.EXAMPLES">Examples</a><br>
|
|
<a href="#RTNSUBR.ERROR.MESSAGES">Error messages</a></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div> <a name="RTNSUBR"></a>
|
|
<p>The Return from Subroutine (RTNSUBR) command returns control to the command immediately following the Call Subroutine (CALLSUBR) command that called the subroutine. The RTNSUBR command must be used within a subroutine, and multiple RTNSUBR commands may be used in a 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 subroutine.
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<table width="100%">
|
|
<tr><td align="right"><a href="#RTNSUBR.Top_Of_Page">Top</a></td></tr>
|
|
</table>
|
|
<hr size="2" width="100%">
|
|
|
|
<div>
|
|
<h3><a name="RTNSUBR.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="#RTNSUBR.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="#RTNSUBR.Top_Of_Page">Top</a></td></tr>
|
|
</table>
|
|
</div>
|
|
<div> <a name="RTNSUBR.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="#RTNSUBR.Top_Of_Page">Top</a></td></tr>
|
|
</table>
|
|
<hr size="2" width="100%">
|
|
<div><h3><a name="RTNSUBR.COMMAND.EXAMPLES">Examples</a> </h3>
|
|
<p>
|
|
<pre>
|
|
PGM
|
|
:
|
|
SUBR SUBR1
|
|
:
|
|
IF (&A *LT 30) THEN(RTNSUBR RTNVAL(-1))
|
|
:
|
|
ENDSUBR
|
|
ENDPGM
|
|
</pre>
|
|
</p>
|
|
<p>This CL subroutine is exited by the RTNSUBR command if &A is less than 30, with a return value of -1.
|
|
</p>
|
|
</div>
|
|
<table width="100%">
|
|
<tr><td align="right"><a href="#RTNSUBR.Top_Of_Page">Top</a></td></tr>
|
|
</table>
|
|
<hr size="2" width="100%">
|
|
<div><h3><a name="RTNSUBR.ERROR.MESSAGES">Error messages</a> </h3>
|
|
<p>None
|
|
</p>
|
|
</div>
|
|
<table width="100%">
|
|
<tr><td align="right"><a href="#RTNSUBR.Top_Of_Page">Top</a></td></tr>
|
|
</table>
|
|
</body>
|
|
</html>
|