FORTRAN Reference Manual
Mixed-Language Programming
FORTRAN Reference Manual—528615-001
13-2
Sharing Files When ENV COMMON Is in Effect
•
Manage shared access to unit 5 and unit 6
•
Manage NonStop process pairs
•
Write run-time diagnostic messages
•
Manage hardware traps
•
Manage $RECEIVE
•
Support intrinsic functions
For more information about the CRE, see the CRE Programmer’s Guide.
Sharing Files When ENV COMMON Is in Effect
This subsection describes how your FORTRAN program shares access to the files 
connected to unit 5 and unit 6 if you specify ENV COMMON.
If you specify ENV COMMON, your FORTRAN routines can share access to the files 
connected to units 5 and 6 with other routines in your process, even if the other 
routines are written in languages other than FORTRAN. The files associated with units 
5 and 6 are referred to generically as standard input and standard output, respectively. 
(The common environment of D-series software also supports shared access to a log 
file—standard log—but you cannot establish a unit connection to the standard log file 
from a FORTRAN routine. FORTRAN writes the message that you specify in PAUSE 
and STOP statements and in the FORTRAN_COMPLETION_ utility to the standard log 
file and also writes diagnostic messages to the standard log file.)
The D-series FORTRAN run-time routines treat all other unit connections just as C-
series run-time routines do. Routines written in C, COBOL85, FORTRAN, Pascal, and 
TAL can share a single file open, but only for the standard files. In FORTRAN, the 
standard files are unit 5 (standard input) and unit 6 (standard output). In COBOL85, 
you access the standard files by executing ACCEPT (standard input) and DISPLAY 
(standard output) verbs. Thus, for example, if a FORTRAN routine writes to unit 6 and 
a COBOL85 routine executes a DISPLAY verb, both routines write to the same open of 
a Guardian file.
In the following example, a COBOL85 routine and a FORTRAN routine are bound into 
a single object file:
COBOL85 routine:
DISPLAY "Hello from COBOL".
FORTRAN routine:
OPEN (6, MODE = 'OUTPUT')
WRITE (6, 100)
100 FORMAT(1X, 'Hello from FORTRAN')










