FORTRAN Reference Manual

Mixed-Language Programming
FORTRAN Reference Manual528615-001
13-3
Module Compatibility
Both the COBOL85 DISPLAY verb and the FORTRAN WRITE statement write to the
same file open of the same Guardian file.
Shared access to units 5 and 6 enables you to coordinate FORTRAN I/O to unit 5 and
unit 6 with I/O statements executed in modules written in languages other than
FORTRAN. For example, if you run a program in which routines written in both C and
in FORTRAN connect unit 5 to a disk file, alternate reads of the disk file by routines
written in C and routines written in FORTRAN access successive records from the disk
file, although both the C routines and the FORTRAN routines open the file in their own
environment. Without file sharing, successive reads by routines written in C and in
FORTRAN would repeat records already read by a routine in the other language.
(Actually, without explicit support for file sharing, it is unlikely that routines written in C
and in FORTRAN could be bound into one object file and successfully execute I/O
statements.)
Note that only units 5 and 6 are shared with other routines and only if all routines
specify ENV COMMON or default to a mode that Binder treats in the same class as
ENV COMMON. Whether you specify ENV OLD or ENV COMMON, except for the files
associated with unit 5 and unit 6, routines in two or more languages can access the
same file with separate file opens. Each opener reads in succession, each record in
the file, independent of other openers. (If one of the openers has the file open with
protected access, the other opener, accessing the file with shared access, might be
affected by the records written by the opener with protected access.)
In addition, whether you specify ENV OLD or ENV COMMON, you can share a file
open between modules of a program by passing the Guardian file number.
For more information on how FORTRAN shares access to units 5 and 6—in particular,
the values of the file attributes required to share file opens—see the OPEN Statement
on page 7-70. For a detailed explanation of file sharing, see the CRE Programmer’s
Guide.
Module Compatibility
The Binder program defines three groups—or classes—of object files. The three
Binder groups are old, common, and neutral. FORTRAN modules created with ENV
OLD in effect are classified in the old Binder group. FORTRAN modules created with
ENV COMMON in effect are classified in the common Binder group. You cannot create
a FORTRAN module for the neutral Binder group. You can create neutral modules only
in TAL and in Pascal.
When you create a new object file using Binder, the input files must all be in the
Old or neutral groups and the resultant object file uses the a C-series FORTRAN
run-time library.
Common or neutral groups and the resultant object file uses the D-series
FORTRAN run-time library.
You cannot bind together modules from both the old and the common groups.