WAIT statement

Standard: F77 F90 F95 F2003 Example program


WAIT ( wait-spec-list )

wait-spec-list ::= wait-spec [ , wait-spec ]...

wait-spec ::= [ UNIT= ] expression
| END=label
| EOR=label
| ERR=label
| ID=expression
| IOMSG=variable
| IOSTAT=variable

The optional “UNIT =” may be omitted if and only if it is the first wait-spec in the list.


The WAIT statement waits for asynchronous input/output on the specified unit to finish. If the ID= specifier is used to identify a particular asynchronous input/output operation, only that operation is waited for; otherwise all pending operations on that unit are waited for.

If a waited-for operation has an end-of-file, end-of-record or error condition, it is indicated in the WAIT statement in the normal manner through the END=, EOR=, ERR=, IOMSG= and IOSTAT= specifiers.

It is not an error to wait for asynchronous operations when there are in fact none pending, even if the unit is not open for asynchronous input/output or not even connected.

Note that the CLOSE, INQUIRE, and file positioning statements may also implicitly perform WAIT operations.


ASYNCHRONOUS attribute, ASYNCHRONOUS= specifier, BACKSPACE statement, CLOSE statement, END= specifier, EOR= specifier, ERR= specifier, ID= specifier, INQUIRE statement, IOMSG= specifier, IOSTAT= specifier, OPEN statement, REWIND statement, UNIT= specifier