FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-78
OPEN Statement
If your program is compiled with ENV COMMON in effect, and you open unit 5 or
unit 6 without specifying a PROTECT attribute, the FORTRAN run-time library
determines the protection attribute based on the type of device you are accessing
and the protection attribute of any previous opens of the same unit.
STACK checkpoint specifier
PROTECTED INPUT S S F F F F F F F
OUTPUT SFFSFF F FF
I-O SFFFFF F FF
EXCLUSIVE INPUT FFFFFF F FF
OUTPUT FFFFFF F FF
I-O FFFFFF F FF
S means that the open is successful; F means that the open fails.
Note. If you compile your program with either a C-series FORTRAN compiler or a D-series
FORTRAN compiler for which you specify ENV OLD, and you open unit 5 or unit 6, the
FORTRAN run-time routines use 'SHARED' as the value for the PROTECT attribute if you do
not specify one.
If you compile your program with a D-series FORTRAN compiler, you specify ENV COMMON,
and you open unit 5 or unit 6 without specifying the PROTECT attribute, FORTRAN determines
the PROTECT attribute as follows:
If the file is already open, FORTRAN uses the PROTECT attribute specified when the file
was first opened.
If the file is not already open, FORTRAN determines the PROTECT attribute based on the
type of device you are opening. This table shows the default protection for the devices you
can open for units 5 and 6:
Device Unit 5 Unit 6
Process 'PROTECTED' 'EXCLUSIVE'
$RECEIVE 'EXCLUSIVE‘ N.A.
Disk 'PROTECTED' 'EXCLUSIVE'
Printer N.A. 'EXCLUSIVE'
Terminal 'SHARED’ 'SHARED'
Table 7-8. File Protection and Mode Interaction Between Opening
Processes (page 2 of 2)
File Already Open With
Open Operation Attempted With SHARED PROTECTED EXCLUSIVE
Protection
Specifier Mode Specifier I O I-O I O I-O I O I-O