FORTRAN Reference Manual
Mixed-Language Programming
FORTRAN Reference Manual—528615-001
13-20
Calling C Subprograms From FORTRAN
°
If the FORTRAN subprogram is compiled with any EXTENDEDREF, 
LARGECOMMON, or LARGEDATA directives, the ACCESS MODE IS 
EXTENDED-STORAGE clause must be included in each level 01 or 77 data 
item in the Linkage Section of the Data Division of the called COBOL85 
subprogram, so that the called COBOL85 subprogram will expect the 
doubleword argument addresses that FORTRAN will provide.
°
Otherwise, the ACCESS MODE IS STANDARD clause must be specified or 
assumed for each item in the Linkage Section, so that the called COBOL85 
subprogram will expect the word-address arguments that FORTRAN generates 
in this case.
•
The called COBOL85 subprogram’s Procedure Division must begin with a header 
that includes the USING phrase if you want to pass parameters to the COBOL85 
routine.
•
Your FORTRAN program can call a COBOL85 subprogram that has no 
parameters. The COBOL85 program’s Data Division must not have a Linkage 
Section, its Procedure Division header must not have a USING phrase, and the 
compilation unit must specify a COBOL85 MAIN directive. The name specified on 
the MAIN directive must be different than the name of the COBOL85 subprogram 
that you call. Here is an example:
?MAIN NotFortranProgram
IDENTIFICATION DIVISION.
PROGRAM-ID. FortranProgram.
DATA DIVISION.
...
PROCEDURE DIVISION.
...
•
FORTRAN can call COBOL85 subprograms only as subroutines not as functions.
Calling C Subprograms From FORTRAN
If you write a FORTRAN program that calls a C subprogram (that is, a C function), you 
must observe the following rules:
•
You cannot bind FORTRAN routines compiled with ENV OLD in effect with C 
subprograms.
•
The name of the C subprogram must not contain any lower case letters, because 
FORTRAN always upshifts all names.
•
The C subprogram must not be compiled with the OLDCALLS pragma.
•
The prototype of the C subprogram must not specify a variable number of 
parameters.










