# OPEN: NEWUNIT Specifier

The NEWUNIT specifier opens a file on an unused unit number that is automatically chosen. It also returns the unit number that was chosen. It takes the following form:

NEWUNIT = u-var

u-var | Is a scalar integer variable that is assigned the automatically chosen unit number. It is always a negative integer.

If the OPEN is successful, u-var can be used in subsequent I/O statements to access the connected file.

If an error occurs during execution of the OPEN statement containing the NEWUNIT= speciifier, the processor does not change the value of the variable.

Parent topic: OPEN Statement Specifiers