Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

WAIT

Statement: Performs a wait operation for a specified pending asynchronous data transfer operation. It takes one of the following forms:

Syntax

WAIT([UNIT=]io-unit [, END=label] [, EOR=label] [, ERR=label] [, ID=id-var] [, IOMSG=msg-var] [, IOSTAT=i-var])

WAIT io-unit

io-unit

(Input) Is an external unit specifier.

label

(Input) Is the label of the branch target statement that receives control if an error occurs.

id-var

(Input) Is a scalar integer variable that is the identifier of a pending data transfer operation for the specified unit. If it is specified, a wait operation is performed for that pending operation. If it is omitted, wait operations are performed for all pending data transfers for the specified unit.

msg-var

(Output) Is a scalar default character variable that is assigned an explanatory message if an I/O error occurs.

i-var

(Output) Is a scalar integer variable that is defined as a positive integer if an error occurs and zero if no error occurs.

A wait operation completes the processing of a pending data transfer operation. Each wait operation completes only a single data transfer operation, although a single statement may perform multiple wait operations.

The WAIT statement specifiers can appear in any order. An I/O unit must be specified, but the UNIT= keyword is optional if the unit specifier is the first item in the I/O control list.

The EOR= specifier only has effect if the pending data transfer operation is a nonadvancing read. The END= specifier only has effect if the pending data transfer operation is a READ.

Example

The following example shows how the WAIT statement can be applied.

program test
integer, asynchronous, dimension(100) :: array
open (unit=1,file='asynch.dat',asynchronous='YES',&
  form='unformatted')
write (1) (i,i=1,100)
rewind (1)
read (1,asynchronous='YES') array
wait(1)
write (*,*) array(1:10)
end