Wait (WAIT)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
Threadsafe: No
Parameters
Examples
Error messages

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 procedure. 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 procedure. 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 procedure.

The program waits the number of seconds specified for 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.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
DEV CL var for responding device CL variable name, *NONE Optional, Positional 1
OPNID Open file identifier Simple name, *NONE Optional
Top

CL var for responding device (DEV)

Specifies the name of the CL variable that receives the name of the display device that responds with user data for the CL procedure.

*NONE
No CL variable name is specified; the name of the responding device is not needed.
name
Specify the name of the CL variable that receives the name of the responding device. A device name cannot be specified.
Top

Open file identifier (OPNID)

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.

*NONE
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.
simple-name
Specify a name that matches the OPNID parameter value on a preceding DCLF command in the same CL procedure.
Top

Examples

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 procedure does not wait for the data. The WAIT command causes the procedure 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 CL variables associated with the record format of the declared file.

Example 2: Receiving Data Using Open File Identifier

DCLF   FILE(DF1)  RCDFMT(FMT1)  OPNID(DSPF1)
 :
RCVF   DEV(DEV1)  OPNID(DSPF1)  WAIT(*NO)
 :
WAIT   DEV(*NONE)  OPNID(DSPF1)

In this example, the RCVF command specifies to use the display file associated with open file identifier DSPF1, namely DF1. The procedure does not wait for user data. When the WAIT command is issued with the same open file identifier, the data received is placed in the CL variables declared for record format FMT1 of display file DF1. The name of the responding device is not returned into a CL variable.

Top

Error messages

*ESCAPE Messages

CPF0859
File override caused I/O buffer size to be exceeded.
CPF0882
No corresponding RCVF or SNDRCVF command for WAIT command.
CPF0886
Record contains a data field that is not valid.
CPF0888
Command not run because job being ended.
CPF0889
No data available for input request within specified time.
CPF4101
File &2 in library &3 not found or inline data file missing.
CPF5068
Program device &4 not found in file &2 in library &3.
CPF5070
File &2 in library &3 has no program devices acquired.
Top