Command reference / CL

RCVF

Receive File

Used by a CL program or ILE CL procedure to receive data from a display device or database file. Each RCVF reads one record and copies its fields into the CL variables that DCLF declared at compile time, one per field. Only one record format from the DCLF can be specified per RCVF. If the file is not open, this command opens it. If an earlier RCVF closed it on end-of-file, an error occurs. A file can be overridden only before it is opened: a display file only to another display file, and a database file only to another database file with a single record format. The overriding fields must match the CL variables.

Allowed environments: *BPGM, *IPGM. Use within a CL program. Positional parameters: 2.

Restrictions

Parameters

DEV Display device

Names the display device to receive data from. A CL variable can hold the name so one RCVF serves several devices. Valid only when the file is a display device file.

Type
*NAME
Required
No
Default
*FILE
Length
10
Case
Uppercase

Suggested / special values: *FILE

*FILE
Uses the device associated with the device file. Not allowed if the device file names more than one device.

RCDFMT Record format

Names the record format used to receive data. Must be coded when the device file has more than one record format. For database files it maps the record into the CL variables. RCVF ignores the INVITE DDS keyword.

Type
*NAME
Required
No
Default
*FILE
Length
10
Case
Uppercase

Suggested / special values: *FILE

*FILE
Used when the device file has only one record format. Not allowed if it has more than one.

OPNID Open file identifier

Names the open file identifier from a preceding DCLF in the same program. A CL variable cannot be used.

Type
*SNAME
Required
No
Default
*NONE
Length
10
Case
Uppercase

Suggested / special values: *NONE

*NONE
No identifier. Uses the file from the DCLF that specified *NONE. Only one file per program can use *NONE.

WAIT Wait

Specifies whether the program waits for device input or continues to later commands until a WAIT command. Valid only for display device files.

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *YES, *NO

*YES
The program waits until the input completes before the next command runs.
*NO
The program does not wait. A later WAIT command must complete the input.

Examples

RCVF OPNID(*NONE)

Receives from database file MENU1, which was declared by DCLF with no open file identifier.

RCVF DEV(DISPLAY2) RCDFMT(R1)

Receives data from the user at display DISPLAY2 in record format R1 of device file SCREENX, and waits for the input.

IBM command documentation

Generated from os/cl/catalog/RCVF.json and os/cl/help/RCVF.json.