FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-72
OPEN Statement
The default value for sync is device dependent. For more information, see the
FILE_OPEN_ procedure in the Guardian Procedure Calls Reference Manual.
MODE = mode
mode is a character expression with the value 'INPUT', 'OUTPUT', or 'I-O' that
specifies whether the file is to be used for reading, writing, or reading and
writing. The default value (in the absence of a UNIT directive or ASSIGN
command specifying otherwise) is 'I-O'.
PROTECT = prtct
prtct is a character expression with the value 'SHARED', 'PROTECTED', or
'EXCLUSIVE' that specifies how the file is to be shared. The default value is
'SHARED'. For more information, see Considerations and the Guardian
Programmer’s Guide.
STACK = stack
stack is a character expression with the value 'YES' or 'NO'. For additional
information, see Considerations.
Considerations
An OPEN statement must contain one unit specifier and not more than one each
of the other control specifiers.
If you omit the UNIT keyword from the unit specifier, unit must be the first item in
the list.
You can change the value of the blank specifier for an open file by executing an
OPEN statement that specifies BLANK = blank. You cannot change the value of
any other open-spec for a unit that is already open.
All specifiers that are quoted values (for example, 'YES') must be in upper case
letters.
Using OPEN with EDIT format files
The file does not have to exist before you open it, but if it does not exist, you must
have specified file code 101 for the file in a UNIT directive or an ASSIGN
command. For information on how to create an EDIT format file, see Section 5,
Introduction to File I/O in the HP NonStop Environment. The SYNCDEPTH and
TIMED specifiers do not apply to EDIT format files.
Specifying PROTECT='SHARED' when a process can have the file open with
MODE='OUTPUT' or 'I-O' can cause inconsistent results.
If you specify the ENV COMMON and NONSTOP compiler directives, the
FORTRAN run-time system reports error 257 if you specify MODE = 'OUTPUT' or
MODE = 'I-O'.