Top: f77 Up: 13 - Statements
Previous: 13,38 - IMPLICIT_NONE Next: 13,40 - Input_Output
Section 13,39: INCLUDE
Directs the compiler to stop reading statements from the current
file and read the statements in the included file. When it reaches
the end of the included file, the compiler resumes compilation with
the next statement after the INCLUDE statement. Statement format:
INCLUDE 'full-file-name[/[NO]LIST]'
INCLUDE '[text-lib] (module-name)[/[NO]LIST]' (VMS only)
full-file-name Is a character string that specifies
the file to be included. The form of
the "full-file-name" must be acceptable
to the operating system, as described
in your user manual.
/[NO]LIST Specifies whether the incorporated code
is to appear in the compilation source
listing. (On U*X systems, you must specify
the -vms compiler option to use this
qualifier.) In the listing, a number
precedes each incorporated statement. The
number indicates the "include" nesting
depth of the code. The default is /NOLIST.
/LIST and /NOLIST must be spelled completely.
text-lib (VMS only) Is a character string that specifies
the "full-file-name" of the text
library to be searched. Its form must
be acceptable to the operating system,
as described in your user manual.
module-name (VMS only) Is the name of the text module, located
in a text library, that is to be included.
The name of the module must be enclosed
in parentheses. It can be up to 31 char-
acters long and can contain any alpha-
numeric character and the special char-
acters dollar sign ($) and underscore (_).
The file must contain valid Fortran statements. The file cannot
start with a continuation line, but it can contain an INCLUDE
statement.
The limit on nesting depth is when system resources are exhausted.
In the following example, the file COMMON.FOR defines a parameter
constant M, and defines arrays X and Y as part of the blank common
block.
Main Program File COMMON.FOR File
----------------- ---------------
INCLUDE 'COMMON.FOR' PARAMETER (M=100)
DIMENSION Z(M) COMMON X(M),Y(M)
CALL CUBE
DO 5, I=1,M
5 Z(I) = X(I)+SQRT(Y(I))
.
.
.
END
SUBROUTINE CUBE
INCLUDE 'COMMON.FOR'
DO 10, I=1,M
10 X(I) = Y(I)**3
RETURN
END
Top: f77 Up: 13 - Statements
Previous: 13,38 - IMPLICIT_NONE Next: 13,40 - Input_Output