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

270 lines
12 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>Receive File (RCVF)</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="RCVF.Top_Of_Page"></a>
<h2>Receive File (RCVF)</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>Conditional
</td>
<td valign="top" align="right">
<a href="#RCVF.PARAMETERS.TABLE">Parameters</a><br>
<a href="#RCVF.COMMAND.EXAMPLES">Examples</a><br>
<a href="#RCVF.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="RCVF"></a>
<p>The Receive File (RCVF) command is used by a CL procedure to receive data from a display device or database file. The command reads a record from the file and puts the data from the record into one or more CL variables. These CL variables were automatically declared in the program when the CL source program was compiled and a Declare File (DCLF) command was processed as part of the source. There is one CL variable for each field in the record format used to receive the data. The data that is entered by a user at the display or is contained in the input record is copied into CL variables in the program by the RCVF command, where it is processed by the program.
</p>
<p>Only one record format, of those specified in the DCLF command, can be specified in each RCVF command. If the file has not been opened by a previous RCVF, SNDRCVF, or SNDF command, it is opened by this command. If the file has been previously closed due to an end-of-file condition on a previous RCVF command, an error occurs. The file specified in this command can be overridden if the override command is entered before the file is opened. If the file specified in the DCLF command was a display file when the program was compiled, the file may only be overridden to another display file. If the file was a database file, the file may only be overridden to another database file that has a single record format. However, care should be taken that the fields in the overriding record format correspond to the CL variables declared in the program.
</p>
<p><b>Restrictions:</b>
</p>
<ul>
<li>This command is valid only within a CL procedure.
</li>
<li>This command is conditionally threadsafe. The RCVF command is threadsafe when issued against a database file. RCVF is not threadsafe when issued against a display file, and should not be used in a job with multiple threads to receive data from a display file.
</li>
</ul>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="RCVF.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="#RCVF.DEV"><b>DEV</b></a></td>
<td valign="top">Display device</td>
<td valign="top"><i>Name</i>, <b><u>*FILE</u></b></td>
<td valign="top">Optional, Positional 1</td>
</tr>
<tr>
<td valign="top"><a href="#RCVF.RCDFMT"><b>RCDFMT</b></a></td>
<td valign="top">Record format</td>
<td valign="top"><i>Name</i>, <b><u>*FILE</u></b></td>
<td valign="top">Optional, Positional 2</td>
</tr>
<tr>
<td valign="top"><a href="#RCVF.OPNID"><b>OPNID</b></a></td>
<td valign="top">Open file identifier</td>
<td valign="top"><i>Simple name</i>, <b><u>*NONE</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RCVF.WAIT"><b>WAIT</b></a></td>
<td valign="top">Wait</td>
<td valign="top"><b><u>*YES</u></b>, *NO</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="RCVF.DEV"></a>
<h3>Display device (DEV)</h3>
<p>Specifies the name of the display device from which data is to be received. If a CL variable name is used in this parameter, only one RCVF command is needed in the program to receive data from several devices. (The variable specifying the device name can be changed while repeatedly running the same command.) This parameter may be specified only if the file is a display device file.
</p>
<dl>
<dt><b><u>*FILE</u></b></dt>
<dd>The user's data is to be received from the device associated with the device file (the device file that was declared in the FILE parameter of the DCLF command). If more than one device name is specified in the device file, *FILE cannot be specified.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the device or the name of the CL variable that contains the name of the device from which the user's data is to be received.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RCVF.RCDFMT"></a>
<h3>Record format (RCDFMT)</h3>
<p>Specifies the name of the record format that is used to receive data from the file. The format contains all the fields in the record. This parameter must be coded with a record format name if there is more than one record format in the device file. If the file is a database file, the specified record format is used to map the data from the record into the CL variables. The actual record format name in the file at run time may be different. RCVF ignores the INVITE DDS keyword.
</p>
<dl>
<dt><b><u>*FILE</u></b></dt>
<dd>There is only one record format in the device file; that is the format in which the data is to be received. If more than one record format is specified in the device file, *FILE cannot be specified.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the record format in which the data records from the display device are to be received. A CL variable cannot be used to specify the record format name.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RCVF.OPNID"></a>
<h3>Open file identifier (OPNID)</h3>
<p>Specifies the open file identifier that was declared on a preceding Declare File (DCLF) command in the same CL procedure. A CL variable cannot be specified for this parameter value.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No open file identifier is provided. This command will use the file associated with the DCLF command that had *NONE specified for the OPNID parameter. Only one file can be declared in a CL procedure with *NONE as the open file identifier.
</dd>
<dt><b><i>simple-name</i></b></dt>
<dd>Specify a name that matches the OPNID parameter value on a preceding DCLF command in the same CL procedure.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RCVF.WAIT"></a>
<h3>Wait (WAIT)</h3>
<p>Specifies whether the CL procedure waits for the data to be received from the user's device or continues processing the commands that follow this RCVF command. If WAIT(*NO) is specified, the program must issue a WAIT command later in the program to complete the input operation. This parameter may be specified only if the file is a display device file.
</p>
<dl>
<dt><b><u>*YES</u></b></dt>
<dd>The program waits until the input operation from the device is completed; the next command is not processed until then.
</dd>
<dt><b>*NO</b></dt>
<dd>The program does not wait for the input data; commands continue running until a WAIT command is reached later in the program.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RCVF.COMMAND.EXAMPLES">Examples</a> </h3>
<p><b>Example 1: Receive Data from Database File</b>
</p>
<p>
<pre>
DCLF FILE(MENU1)
:
RCVF OPNID(*NONE)
</pre>
</p>
<p>The CL procedure receives data from the database file named MENU1. The RCVF command is associated with the Declare File command that does not have an open file identifier specified.
</p>
<p><b>Example 2: Receive Data from Display Device</b>
</p>
<p>
<pre>
DCLF FILE(SCREENX) RCDFMT(R1 R2)
:
RCVF DEV(DISPLAY2) RCDFMT(R1)
</pre>
</p>
<p>The CL procedure receives data from the user at the display station named DISPLAY2. The data is received in the record format named R1 in the device file named SCREENX. The procedure waits for the user data before it continues processing.
</p>
<p><b>Example 3: Handling End-of-File Exception</b>
</p>
<p>
<pre>
DCLF FILE(INPUT) OPNID(INFILE1)
:
RCVF OPNID(INFILE1)
MONMSG CPF0864 EXEC(GOTO EOF)
</pre>
</p>
<p>The CL procedure receives a record sequentially from the database file named INPUT. The procedure monitors for the end-of-file exception CPF0864 and goes to label EOF when the message is received.
</p>
<p><b>Example 4: Using RCVF with WAIT command</b>
</p>
<p>
<pre>
DCLF FILE(MSCREEN) RCDFMT(MIN1 MIN2 MIN3)
:
RCVF DEV(&amp;DNAME) RCDFMT(MIN2) WAIT(*NO)
WAIT DEV(&amp;DNAME)
</pre>
</p>
<p>The CL procedure receives user data from several devices one at a time by way of the device file named MSCREEN. The procedure receives data from the device named in the variable &amp;DNAME using the record format MIN2, but it does not wait for the data to come in. The same RCVF command is used to receive data from several devices; because the CL variable &amp;DNAME is used, only the device name in the DEV parameter must be changed each time the command is run. A WAIT command for each device must be issued later in the procedure because the WAIT command actually receives the data. Both the RCVF and the WAIT commands may be processed for each device (one at a time) to send data to the procedure. If a user response is delayed, the commands can be processed as many times as necessary until the user responds with the data or a End Receive (ENDRCV) command cancels the request.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RCVF.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>CPF0859</b></dt>
<dd>File override caused I/O buffer size to be exceeded.
</dd>
<dt><b>CPF0860</b></dt>
<dd>File &amp;1 in &amp;2 not a data base file.
</dd>
<dt><b>CPF0861</b></dt>
<dd>File &amp;1 in library &amp;2 is not a display file.
</dd>
<dt><b>CPF0863</b></dt>
<dd>Value of binary data too large for decimal CL variable.
</dd>
<dt><b>CPF0864</b></dt>
<dd>End of file detected for file &amp;1 in &amp;2.
</dd>
<dt><b>CPF0865</b></dt>
<dd>File &amp;1 has more than one record format.
</dd>
<dt><b>CPF0883</b></dt>
<dd>*FILE not valid in DEV parameter for file &amp;1.
</dd>
<dt><b>CPF0886</b></dt>
<dd>Record contains a data field that is not valid.
</dd>
<dt><b>CPF4101</b></dt>
<dd>File &amp;2 in library &amp;3 not found or inline data file missing.
</dd>
<dt><b>CPF502A</b></dt>
<dd>Variable length record error on member &amp;4.
</dd>
<dt><b>CPF502B</b></dt>
<dd>Error occurred in trigger program.
</dd>
<dt><b>CPF502D</b></dt>
<dd>Referential constraint violation on member &amp;4.
</dd>
<dt><b>CPF502E</b></dt>
<dd>Referential constraints could not be validated for member &amp;4.
</dd>
<dt><b>CPF502F</b></dt>
<dd>Check constraint violation on member &amp;4.
</dd>
<dt><b>CPF5029</b></dt>
<dd>Data mapping error on member &amp;4.
</dd>
<dt><b>CPF503A</b></dt>
<dd>Referential constraint violation on member &amp;4.
</dd>
<dt><b>CPF503B</b></dt>
<dd>Record could not be inserted or updated in member &amp;4.
</dd>
<dt><b>CPF5068</b></dt>
<dd>Program device &amp;4 not found in file &amp;2 in library &amp;3.
</dd>
<dt><b>CPF5070</b></dt>
<dd>File &amp;2 in library &amp;3 has no program devices acquired.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RCVF.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>