8 Program Units and Procedures

A Fortran 95/90 program consists of one or more program units. There are four types of program units:

A program unit does not have to contain executable statements; for example, it can be a module containing interface blocks for subroutines.

A procedure can be invoked during program execution to perform a specific task. There are several kinds of procedures, as follows:

Kind of Procedure  Description 
External Procedure  A procedure that is not part of any other program unit. 
Module Procedure  A procedure defined within a module 
Internal Procedure1  A procedure (other than a statement function) contained within a main program, function, or subroutine 
Intrinsic Procedure  A procedure defined by the Fortran language 
Dummy Procedure  A dummy argument specified as a procedure or appearing in a procedure reference 
Statement function  A computing procedure defined by a single statement  
1 The program unit that contains an internal procedure is called its host.

A function is invoked in an expression using the name of the function or a defined operator. It returns a single value (function result) that is used to evaluate the expression.

A subroutine is invoked in a CALL statement or by a defined assignment statement. It does not directly return a value, but values can be passed back to the calling program unit through arguments (or variables) known to the calling program.

Recursion (direct or indirect) is permitted for functions and subroutines.

A procedure interface refers to the properties of a procedure that interact with or are of concern to the calling program. A procedure interface can be explicitly defined in interface blocks. All program units, except block data program units, can contain interface blocks.

This chapter contains information on the following topics:

For More Information:


Previous Page Next Page Table of Contents