- 论坛徽章:
- 0
|
看看有没有用?
Example 1: Receive Data from Database File
DCLF FILE(MENU1)
:
RCVF OPNID(*NONE) 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.
Example 2: Receive Data from Display Device
DCLF FILE(SCREENX) RCDFMT(R1 R2)
:
RCVF DEV(DISPLAY2) RCDFMT(R1)
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.
Example 3: Handling End-of-File Exception
DCLF FILE(INPUT) OPNID(INFILE1)
:
RCVF OPNID(INFILE1)
MONMSG CPF0864 EXEC(GOTO EOF)
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.
Example 4: Using RCVF with WAIT command
DCLF FILE(MSCREEN) RCDFMT(MIN1 MIN2 MIN3)
:
RCVF DEV(&DNAME) RCDFMT(MIN2) WAIT(*NO)
WAIT DEV(&DNAME)
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 &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 &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. |
|