FORTRAN Reference Manual
Introduction to File I/O in the HP NonStop
Environment
FORTRAN Reference Manual—528615-001
5-13
Unit Connection
If you entered FT002 for logical-unit, the following information would be displayed:
FT002
PHYSICAL FILE: DATAFILE
EXCLUSION: EXCLUSIVE
ACCESS: INPUT
To get a list of the assigned attributes of all logical units, enter:
1> ASSIGN
For additional information on the ASSIGN command, see the TACL Reference Manual.
Unit Connection
A BACKSPACE, ENDFILE, OPEN, POSITION, PRINT, READ, REWIND, or WRITE
statement establishes a connection to a unit. A CLOSE statement closes the
connection to a unit. An INQUIRE statement does not alter whether a unit is connected
or not.
A unit cannot be connected to more than one file at a time, but a file can be connected
to any number of units at the same time.
No FORTRAN I/O statement requires that the unit be connected before you execute
the statement. All I/O statements except CLOSE and INQUIRE automatically connect
the unit if it is not already connected. That is, they create the file if it does not already
exist (except for structured files), and open it if necessary.
If an OPEN statement opens a unit that is already connected, the unit is closed and
opened anew. For example, the effect of the following statements is the same as if a
CLOSE statement without a STATUS specifier had been executed between the opens
for FILE1:
OPEN (15, FILE= 'file1')
OPEN (15, FILE= 'file2')
If any I/O statement connects a unit that is not assigned to a file name (the unit number
is not 4, 5, or 6, and no UNIT directive or ASSIGN command has specified a file name
for the unit, and the I/O statement is not an OPEN statement with FILE = a nonblank
name), then the system creates a new temporary file with a unique file name on the
default disk volume for the program, and opens it, thus connecting the new file to the
unit.
Specifying File Attributes
You can use the UNIT directive and the ASSIGN command to specify other file
attributes in addition to the file name. For details, see the UNIT Compiler Directive on
page 10-67 and the description of the ASSIGN command in this section.










