



Any set of computations can be encapsulated in a procedure. The main purpose of a
procedure is to allow the same set of operations to be invoked at different points in a
program. Procedures also make it possible to use the same code in several
different programs. It is good practice to split a large program into sections
whenever it becomes too large to be handled conveniently in one piece. The
optimum size of a program unit is quite small, probably no more than 100
lines.
Four different forms of procedure can be used in Fortran programs:-
- Intrinsic functions
- Statement functions
- External functions (also known as function subprograms)
- Subroutines.
Intrinsic functions are provided automatically by the Fortran system, whereas the
other three forms of procedure are user-written. Statement functions, which are
defined with the statement function statement, can be only be used in the program
unit in which they were defined and are subject to other special restrictions. External
functions and subroutines are two alternative forms of external procedure: each is
specified as a separate program unit and can be used (with only a few restrictions)
anywhere else in the program.
9.1 Intrinsic Functions
9.2 Statement Functions
9.3 External Procedures
9.4 Arguments of External Procedures
9.5 Variables as Dummy Arguments
9.6 Arrays as Arguments
9.7 Procedures as Arguments
9.8 Subroutine and Call Statements
9.9 RETURN Statement
9.10 FUNCTION Statement
9.11 SAVE Statement
9.12 EXTERNAL and INTRINSIC Statements



