FORTRAN Reference Manual

Program Units
FORTRAN Reference Manual528615-001
4-2
The Main Program and Subprograms
The term external function refers to
External functions specified in function subprograms
External functions written in languages other than FORTRAN subprograms
The term subroutine refers to
Subroutines specified in subroutine subprograms
Subroutines written in languages other than FORTRAN
Intrinsic functions are described in Section 8, Intrinsic Functions. Statement functions
are described in Section 7, Statements.
Section 13, Mixed-Language Programming, describes non-FORTRAN procedures that
are either system procedures or procedures written in languages other than
FORTRAN.
A FORTRAN procedure (or other subprogram) is a program unit that begins with a
FUNCTION or SUBROUTINE statement, and ends with an END statement. You can
compile subprograms separately from the main program. Section 9, Program
Compilation, describes separate compilation.
FORTRAN also includes a nonexecutable subprogram called a BLOCK DATA
subprogram that you can use to assign initial data values to COMMON entities.
Table 4-1. FORTRAN Program Units
Main Program
Subroutine
Program
Function
Subprogram
Block Data
Subprogram
Executable Executable Executable Nonexecutable
Not typed Not typed Typed implicitly or
explicitly
Not typed
RETURN not
allowed
Alternate RETURN
allowed
RETURN allowed RETURN not
allowed
N.A. Accepts values
through arguments
or common blocks
Accepts values
through arguments
or common blocks
N.A.
N.A. Returns values
through arguments
or common blocks
Returns a value for
the function name, or
through arguments
or common blocks
N.A.