FORTRAN Reference Manual

Introduction to File I/O in the HP NonStop
Environment
FORTRAN Reference Manual528615-001
5-9
File Existence
Exist or not exist
Be open or not open
For a FORTRAN executable program, a unit can:
Exist or not exist
Be assigned or not assigned
Be connected or not connected
File Existence
A disk file exists if it is known to the system. It need not have any data records in it.
If you do not name the file at the time of connection, FORTRAN creates a temporary
file, which it purges when you close the file or your process terminates.
You create a structured file only by using utility programs (such as FUP) that initialize
the required record key indexing data structures within the file. For additional
information, see Structured Files on page 5-18.
A nondisk file name is simply a device name or a process name. Such a file exists if
and only if the device or process exists.
Opening a File
A file is open for an executing program if the system is prepared to accept requests
from that program for transferring data to or from that file, for example, if the program
has at least one Guardian open file number for the file. The open state begins and
ends with calls to the Guardian file-system procedures OPEN and CLOSE,
respectively. The FORTRAN processor makes such calls automatically when a
FORTRAN unit is connected or disconnected. A file must exist before it can be
opened. For a disk file, FORTRAN automatically creates the file, if necessary, to satisfy
this requirement. Thus, for FORTRAN, creating a file and opening a file can be one
single operation.
A disk file can be opened by more than one opener at the same time. The multiple
openers can be in different processes or in the same process. The openers can be
from routines written in FORTRAN or in other HP NonStop languages. FORTRAN
associates each open of a Guardian file with the unit number you specify in a
FORTRAN OPEN statement. Thus, you can have one or more unit numbers
associated with the same Guardian file, each with its own Guardian file number.