WAIT (Wait)
Purpose
The Wait (WAIT) command accepts input from any display device from which user data is requested by one or more previous Receive File (RCVF), Send File (SNDF), or Send/Receive File (SNDRCVF) commands that do not wait to receive the input data. Those commands had *NO specified in the WAIT parameter or, in the case of SNDF, had the INVITE DDS keyword option specified in the record format sent to the display, and specified a particular device file to receive and transfer the data to the CL program. Only one input request per device can be outstanding at any given time. If there are multiple outstanding input requests, the user data of the first device to respond to the specified device file is sent to the CL program. If the data is received within the wait interval, the Wait operation ends and the next command in the program is processed. Otherwise an escape message is sent to the CL program.
The program waits the number of seconds specified on the WAITRCD keyword of the Create Display File (CRTDSPF), Change Display File (CHGDSPF), or Override with Display File (OVRDSPF) commands for a device to respond to an input request.
Restriction: This command is valid only for display files within a CL program. It cannot be used with database files.
Optional Parameters
- DEV
- Specifies the name of the CL variable that receives the name of the display device that responds with user data for the CL program.
*NONE: No CL variable name is specified; the name of the responding device is not needed.
CL-variable-name: Specify the name (up to 10 characters) of the CL variable that receives the name of the responding device. A device name cannot be specified in this parameter.
Examples for WAIT
Example 1: Receiving User Data
DCLF FILE(MSCREEN) * * * RCVF DEV(DEV1) WAIT(*NO) * * * RCVF DEV(DEV2) WAIT(*NO) * * * WAIT DEV(&DEVNAM)In this example, the device file MSCREEN is used to receive user data. The RCVF commands specify that the program does not wait for the data. The WAIT command causes the program to wait for the display device file MSCREEN to pass input data to it from one of its devices. The name of the responding display device is placed in the CL variable &DEVNAM. The received data is placed in the program variables associated with the record format of the declared file.
Example 2: Receiving Data in the Program Variable
DCLF FILE(DF1) * * * RCVF DEV(DEV1) WAIT(*NO) * * * RCVF DEV(DEV2) WAIT(*NO) * * * WAIT DEV(&DN)In this example, the RCVF commands specify that the program does not wait for user data. When the WAIT command is issued, the name of the responding device is placed in the CL variable &DN. The data received from the device file DF1 is placed in the program variable of the associated record format in the file DF1.
Error messages for WAIT
*ESCAPE Messages
- CPF3204
- Cannot find object needed for file &1 in &2.
- CPF7306
- Member &1 not added to file &2 in &3.