+-------------------------------IBM Extension--------------------------------+
Purpose
The WAIT statement may be used to wait for an asynchronous data
transfer to complete or it may be used to detect the completion status of an
asynchronous data transfer statement.
Syntax
>>-WAIT--(--wait_list--)---------------------------------------><
|
- wait_list
- is a list that must contain one ID= specifier and at most one of
each of the other valid specifiers. The valid specifiers are:
- DONE= logical_variable
- specifies whether or not the asynchronous I/O statement is
complete. If the DONE= specifier is present, the
logical_variable is set to true if the asynchronous I/O is complete
and is set to false if it is not complete. If the returned value is
false, then one or more WAIT statements must be executed until either
the DONE= specifier is not present, or its returned value is
true. A WAIT statement without the DONE= specifier,
or a WAIT statement that sets the logical_variable value to
true, is the matching WAIT statement to the data transfer statement
identified by the same ID= value.
- END= stmt_label
- is an end-of-file specifier that specifies a statement label at which the
program is to continue if an endfile record is encountered and no error
occurs. If an external file is positioned after the endfile record, the
IOSTAT= specifier, if present, is assigned a negative value, and the
NUM= specifier, if present, is assigned an integer value.
Coding the END= specifier suppresses the error message for
end-of-file. This specifier can be specified for a unit connected for
either sequential or direct access.
The stmt_label defined for the END= specifier of the
asynchronous data transfer statement need not be identical to the
stmt_label defined for the END= specifier of the matching
WAIT statement.
- ERR= stmt_label
- is an error specifier that specifies the statement label of an executable
statement in the same scoping unit to which control is to transfer in case of
an error. Coding the ERR= specifier suppresses error
messages.
The stmt_label defined for the ERR= specifier of the
asynchronous data transfer statement need not be identical to the
stmt_label defined for the ERR= specifier of the matching
WAIT statement.
- ID= integer_expr
- indicates the data transfer with which this WAIT statement
is identified. The integer_expr is an integer expression of
type INTEGER(4) or default integer. To initiate an
asynchronous data transfer, the ID= specifier is used on a
READ or WRITE statement.
- IOMSG= iomsg_variable
- is an input/output status specifier that specifies the message returned by
the input/output operation. iomsg_variable is a scalar default
character variable. It must not be a use-associated nonpointer
protected variable. When the input/output statement containing this
specifier finishes execution, iomsg_variable is defined as
follows:
- If an error, end-of-file, or end-of-record condition occurs, the variable
is assigned an explanatory message as if by assignment.
- If no such condition occurs, the value of the variable is
unchanged.
- IOSTAT= ios
-
is an input/output status specifier that specifies the status of the
input/output operation. ios is an integer variable.
When the input/output statement containing this specifier finishes execution,
ios is defined with:
- A zero value if no error condition occurs.
- A positive value if an error occurs.
- A negative value if an end-of-file condition is encountered and no error
occurs.
The ios defined for the IOSTAT= specifier of the
asynchronous data transfer statement is not required to be identical to the
ios defined for the IOSTAT= specifier of the matching
WAIT statement.
Rules
The matching WAIT statement must be in the same scoping unit as
the corresponding asynchronous data transfer statement. Within the
instance of that scoping unit, the program must not execute a RETURN,
END, or STOP statement before the matching WAIT
statement is executed.
Related Information
+----------------------------End of IBM Extension----------------------------+
