NEWUNIT= specifier
Standard: F77 F90 F95 F2003 F2008
  Example Program
NEWUNIT = variable

The variable must be a scalar integer variable. This specifier is permitted only in an OPEN statement that has no UNIT= specifier, and either the FILE= specifier must appear or the STATUS= specifier must appear with the value "SCRATCH".
If the OPEN is successful, the variable is assigned a negative value that is not equal to -1 and is not the same as any other unit that is currently open.

The purpose of this specifier is to avoid conflicts between unit numbers in unrelated pieces of code; the runtime system keeps track of which units are open, and because the NEWUNIT= values are negative they can never conflict with a user-specified unit number.

OPEN statement, UNIT= specifier