UNIT= specifier
Standard: F77 F90 F95 F2003
  Example Program
[ UNIT = ] io_unit


The UNIT= specifier is permitted in any input/output statement, except for PRINT, and for INQUIRE with FILE=.

The keyword and equals sign may be omitted if and only if it is the first specifier in the statement.

If io-unit is an expression, it must be a scalar integer expression and must be non-negative, or the value of one of the constants ERROR_UNIT, INPUT_UNIT or OUTPUT_UNIT from the intrinsic module ISO_FORTRAN_ENV.

If io-unit is a variable, it must be a character variable but may be either a scalar or an array; this form is only permitted in READ and WRITE statements.

The asterisk form of io-unit is also permitted only in READ and WRITE statements.
Identifies the logical unit which is the subject of the input/output statement. An io-unit that is an expression identifies an external unit; an io-unit that is a variable identifies an internal unit, and an io-unit that is an asterisk identifies the external unit INPUT_UNIT in a READ statement or the external unit OUTPUT_UNIT in a WRITE statement.

If io-unit is a scalar character variable, the internal unit contains only one record; if it is an array variable, the internal unit has a number of records equal to the number of elements of the array. In each case the length of each record is the character length of the variable.
BACKSPACE statement, CLOSE statement, ENDFILE statement, INQUIRE statement, OPEN statement, READ statement, REWIND statement, WRITE statement