302 lines
14 KiB
HTML
302 lines
14 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>Reclaim Resources (RCLRSC)</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="RCLRSC.Top_Of_Page"></a>
|
||
|
<h2>Reclaim Resources (RCLRSC)</h2>
|
||
|
<table width="100%">
|
||
|
<tr>
|
||
|
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
|
||
|
<b>Threadsafe: </b>No
|
||
|
</td>
|
||
|
<td valign="top" align="right">
|
||
|
<a href="#RCLRSC.PARAMETERS.TABLE">Parameters</a><br>
|
||
|
<a href="#RCLRSC.COMMAND.EXAMPLES">Examples</a><br>
|
||
|
<a href="#RCLRSC.ERROR.MESSAGES">Error messages</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<div> <a name="RCLRSC"></a>
|
||
|
<p>The Reclaim Resources (RCLRSC) command is intended for use by the controlling program in an application to free resources that were allocated by programs that have finished running and returned control to the controlling program. The resources used by these programs can then be used by other programs running on the system. Based on the reference level specified by the LVL parameter, this command reclaims resources that are scoped to the default activation group. This command does not reclaim resources that are scoped to the job or resources that are scoped to any activation group other than the default activation group. The resources that are reclaimed by this command are:
|
||
|
</p>
|
||
|
<ul>
|
||
|
<li>static storage
|
||
|
<p>For an original program model (OPM) program, its static storage will be reclaimed. For a user state Integrated Language Environment (ILE) program, its static storage will be marked so that it will be re-initialized on the next call. Static storage is not affected for a service program, a system state ILE program, or any ILE program running in an activation group other than the default activation group.
|
||
|
</p>
|
||
|
</li>
|
||
|
<li>open files of object type *FILE
|
||
|
</li>
|
||
|
<li>user interface manager (UIM) application resources
|
||
|
</li>
|
||
|
<li>Common Programming Interface (CPI) Communications conversations
|
||
|
</li>
|
||
|
<li>hierarchical file systems (HFS) resources
|
||
|
</li>
|
||
|
<li>user-defined communications sessions.
|
||
|
</li>
|
||
|
</ul>
|
||
|
<p>In addition, after distributed data management (DDM) files are closed based on the criteria described above, all DDM source system conversations in this job that are not currently in use will be ended, regardless of the activation group or reference level from which they were started.
|
||
|
</p>
|
||
|
<p>The RCLRSC command is <b>not</b> needed to reclaim the files and static storage of most programs, such as CL programs that end (return) normally, RPG programs that have the last record (LR) indicator set on, and COBOL programs. The RCLRSC command should <b>not</b> be used if it might be processed while any COBOL program is still active in the application.
|
||
|
</p>
|
||
|
<p>For more information on the appropriate use of this command, see the documentation associated with the programming language(s) used in the application.
|
||
|
</p>
|
||
|
<p><b>Restrictions:</b>
|
||
|
</p>
|
||
|
<ol>
|
||
|
<li>This command is not threadsafe. However, it can be run in the primary thread of a multi-threaded job.
|
||
|
</li>
|
||
|
<li>Do not specify LVL(*CALLER) on this command if it is used in a CL program that also uses the Send File (SNDF), Receive File (RCVF), Send/Receive File (SNDRCVF) commands. Specifying RCLRSC LVL(*CALLER) in such a program causes unpredictable results when the SNDF, RCVF, or SNDRCVF commands are used after the program runs.
|
||
|
</li>
|
||
|
<li>Do not specify LVL(*CALLER) on this command if it is issued from a command line, as this will result in unpredictable results.
|
||
|
</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
|
||
|
<div>
|
||
|
<h3><a name="RCLRSC.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="#RCLRSC.LVL"><b>LVL</b></a></td>
|
||
|
<td valign="top">Program level</td>
|
||
|
<td valign="top"><b><u>*</u></b>, *CALLER</td>
|
||
|
<td valign="top">Optional, Positional 1</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td valign="top"><a href="#RCLRSC.OPTION"><b>OPTION</b></a></td>
|
||
|
<td valign="top">Close option</td>
|
||
|
<td valign="top"><b><u>*NORMAL</u></b>, *ABNORMAL</td>
|
||
|
<td valign="top">Optional</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
<div> <a name="RCLRSC.LVL"></a>
|
||
|
<h3>Program level (LVL)</h3>
|
||
|
<p>Specifies the reference level at which resources are reclaimed.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><u>*</u></b></dt>
|
||
|
<dd>The reference level is the program or procedure that contains this RCLRSC command. The resources are reclaimed for programs or procedures that have finished running and returned control to this program.
|
||
|
</dd>
|
||
|
<dt><b>*CALLER</b></dt>
|
||
|
<dd>The reference level is the program or procedure that called the program or procedure containing this RCLRSC command. This value allows controlling programs or procedures written in a high-level language to call a CL program to reclaim resources to the level of the controlling program or procedure. The effect is the same as if the command were issued from the controlling program or procedure.
|
||
|
<p>
|
||
|
<b>Note: </b>Using the *CALLER value can cause unexpected results when running the RCLRSC command from a command line or from within a program that works with open files.
|
||
|
</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<div> <a name="RCLRSC.OPTION"></a>
|
||
|
<h3>Close option (OPTION)</h3>
|
||
|
<p>Specifies whether a normal or abnormal close notification is sent to the attached host system when mixed, communications, binary synchronous (BSC), and intersystem communications function (ICF) files are closed. This parameter is ignored for all other files and objects.
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b><u>*NORMAL</u></b></dt>
|
||
|
<dd>The attached host system is given a normal close notification when mixed, communications, BSC, and ICF files are closed.
|
||
|
</dd>
|
||
|
<dt><b>*ABNORMAL</b></dt>
|
||
|
<dd>The attached host system is given an abnormal close notification when mixed, communications, BSC, and ICF files are closed. Use this when the controlling program detects error conditions that should be communicated to the host systems (the error condition need not be file-related).
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="RCLRSC.COMMAND.EXAMPLES">Examples</a> </h3>
|
||
|
<p><b>Example 1 (OPM)</b>
|
||
|
</p>
|
||
|
<p>
|
||
|
<pre>
|
||
|
PROGA
|
||
|
:
|
||
|
CALL PROGB
|
||
|
RCLRSC
|
||
|
:
|
||
|
CALL PROGC
|
||
|
RCLRSC
|
||
|
:
|
||
|
</pre>
|
||
|
</p>
|
||
|
<p>In this example, PROGA is a controlling program in an application. PROGA calls other programs, which return control to PROGA when they have finished running. Because control is returned to the next sequential instruction, the RCLRSC command is issued following each CALL command to free the static storage that was used by the called program, and to close the files that were left open.
|
||
|
</p>
|
||
|
<p><b>Example 2 (OPM)</b>
|
||
|
</p>
|
||
|
<table border="1">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<pre>
|
||
|
PROGA +------PROGD
|
||
|
+-----------+ | +---------------------+
|
||
|
| . | | | RCLRSC LVL(*CALLER) |
|
||
|
| . | | +-| RETURN |
|
||
|
|CALL PROGB | | | +---------------------+
|
||
|
| . | | |
|
||
|
| . | | |
|
||
|
|CALL PROGC | | |
|
||
|
| . | | |
|
||
|
| . | | |
|
||
|
|CALL PROGD-+-+ |
|
||
|
| . <-------+----+
|
||
|
+-----------+
|
||
|
</pre>
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>In this example, PROGA is a controlling program that is written in a high-level language. The RCLRSC command cannot be issued from the high-level language program so PROGD, a CL program, is called to issue the command. When the RCLRSC command is issued in PROGD, the static storage used by PROGB and PROGC is freed; files that were left open are closed.
|
||
|
</p>
|
||
|
<p><b>Example 3 (OPM)</b>
|
||
|
</p>
|
||
|
<table border="1">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<pre>
|
||
|
|
||
|
PROGA +------->PROGB
|
||
|
+------------+ | +------------+
|
||
|
| . | | | . |
|
||
|
| . | | | . |
|
||
|
|CALL PROGB--+-+ |CALL PROGC--+--+
|
||
|
| . <--------+----+ | . <--------+--+-+
|
||
|
|RCLRSC | +-----|RETURN | | |
|
||
|
+------------+ +------------+ | |
|
||
|
| |
|
||
|
| |
|
||
|
PROGC<----------+ |
|
||
|
+---------+ |
|
||
|
| . | |
|
||
|
| . | |
|
||
|
|RETURN---+-------+
|
||
|
+---------+
|
||
|
</pre>
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>In this example, PROGA is a controlling program. When the RCLRSC command is issued, the static storage used by PROGB and PROGC is freed; files that were left open are closed.
|
||
|
</p>
|
||
|
<p><b>Example 4 (OPM)</b>
|
||
|
</p>
|
||
|
<table border="1">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<pre>
|
||
|
PROGA PROGC
|
||
|
+--------------+ +-------------+
|
||
|
| . | | . |
|
||
|
| . | | . |
|
||
|
| CALL PROGB | | CALL PROGB |
|
||
|
| | | |
|
||
|
| TFRCTL PROGC | | RCLRSC |
|
||
|
+--------------+ +-------------+
|
||
|
</pre>
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>In this example, PROGA calls PROGB and, after returning from PROGB, PROGA transfers to program PROGC. Because PROGB has already been called, static storage exists, and the call to PROGB from PROGC does not cause any new allocation for static storage; PROGC cannot reclaim the static storage used by PROGB. If PROGB opened files when it was called by PROGA, these files would remain open; if PROGB opened files when it was called by PROGC, these files are closed.
|
||
|
</p>
|
||
|
<p><b>Example 5 (OPM)</b>
|
||
|
</p>
|
||
|
<p>In this example, PROGA calls PROGB, which in turn calls PROGC. PROGC opens a file. Control returns to PROGA. PROGA calls PROGB a second time, and PROGB invokes RCLRSC. Since RCLRSC is based upon the position in the stack of the current invocation of a program, the file opened by PROGC is not affected. PROGC was invoked earlier than the current PROGB. In order for RCLRSC to close the file, the RCLRSC command will have to be invoked by PROGA.
|
||
|
</p>
|
||
|
<p><b>Example 6 (OPM & ILE)</b>
|
||
|
</p>
|
||
|
<table border="1">
|
||
|
<tr>
|
||
|
<td>
|
||
|
<p>
|
||
|
<pre>
|
||
|
Default Activation Group
|
||
|
+----------------------------+
|
||
|
| PROGA |
|
||
|
| +------------+ |
|
||
|
| | CALL PROGB |--+ |
|
||
|
| | . | | | Activation Group AG1
|
||
|
| | . | | | +----------------------+
|
||
|
| | RCLRSC |<-+----+ | | |
|
||
|
| +------------+ | | | | |
|
||
|
| | | | +-----+-> PROCD |
|
||
|
| | | | | | +------------+ |
|
||
|
| | | | | | | . | |
|
||
|
| PROGB <----+ | | | | | . | |
|
||
|
| +------------+ | | | | | . | |
|
||
|
| | CALL PROCC |---+ | | | +--+----| RETURN | |
|
||
|
| | . | | | | | | | +------------+ |
|
||
|
| | . |<--+-+ | | | | | |
|
||
|
| | RETURN |---+-+-+ | | | | |
|
||
|
| +------------+ | | | | | | |
|
||
|
| | | | | | +----------------------+
|
||
|
| | | | | |
|
||
|
| | | | | |
|
||
|
| PROCC <-----+ | | | |
|
||
|
| +------------+ | | | |
|
||
|
| | CALL PROCD | | | | |
|
||
|
| | . |-----+----+--+ |
|
||
|
| | . |<----+----+-----+
|
||
|
| | RETURN |-----+ |
|
||
|
| +------------+ |
|
||
|
+----------------------------+
|
||
|
</pre>
|
||
|
</p>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<p>This example shows how ILE procedures and activation groups are affected by the RCLRSC command.
|
||
|
</p>
|
||
|
<p>In this example, PROGA is a program running in the default activation group. PROGA calls program PROGB which runs in the default activation group. PROGB calls ILE procedure PROCC which runs in the default activation group. PROCC calls ILE procedure PROCD which causes activation group AG1 to be created. PROCD returns to PROCC. PROCC returns to PROGB. PROGB returns to PROGA, which then calls the RCLRSC command.
|
||
|
</p>
|
||
|
<p>PROGA calls the RCLRSC command. Any resources in use by PROGA are still open, since PROGA is still in use. Any resources by program PROGB or procedure PROCC are reclaimed, since the program and procedure ran in the default activation group and are no longer active. Any resources opened by procedure PROCD are left alone, since procedure PROCD ran in activation group AG1 and only the default activation group is affected by the RCLRSC command.
|
||
|
</p>
|
||
|
<p>Any other use of the RCLRSC command can result in files remaining open and storage remaining allocated.
|
||
|
</p>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
<hr size="2" width="100%">
|
||
|
<div><h3><a name="RCLRSC.ERROR.MESSAGES">Error messages</a> </h3>
|
||
|
<p><b><u>*ESCAPE Messages</u></b>
|
||
|
</p>
|
||
|
<dl>
|
||
|
<dt><b>CPF180C</b></dt>
|
||
|
<dd>Function &1 not allowed.
|
||
|
</dd>
|
||
|
<dt><b>CPF1892</b></dt>
|
||
|
<dd>Function &1 not allowed.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
<table width="100%">
|
||
|
<tr><td align="right"><a href="#RCLRSC.Top_Of_Page">Top</a></td></tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|