FORTRAN Reference Manual

Program Units
FORTRAN Reference Manual528615-001
4-15
The Block Data Subprogram
For additional information on using common blocks and memory organization, see
Section 12, Memory Organization.
The Block Data Subprogram
The BLOCK DATA subprogram is a nonexecutable declaration subprogram that
assigns initial values to entities in common blocks. By using the BLOCK DATA
subprogram to initialize common block entities you can save the execution time and
code space that would otherwise be needed to initialize these entities.
A BLOCK DATA subprogram can be either named or unnamed. A FORTRAN program,
however, can contain only one unnamed BLOCK DATA subprogram.
The BLOCK DATA subprogram has the following form:
BLOCK DATA [ name ]
.
END
ABLOCK DATA subprogram can contain only the following statements:
type declaration COMMON
IMPLICIT SAVE
PARAMETER DATA
DIMENSION EQUIVALENCE
Considerations
If the BLOCK DATA subprogram contains an IMPLICIT statement, it must appear
after the BLOCK DATA statement but before any other statements in the
subprogram.
DATA statements must appear before the END statement but after all other
statements.
A COMMON statement must include all elements of the common block, even if you
initialize only some of these elements in the BLOCK DATA subprogram.
Although you can initialize entities in several common blocks in one BLOCK DATA
subprogram, you can use only one BLOCK DATA subprogram to initialize data in
one particular common block.
A BLOCK DATA subprogram cannot contain local variables or arrays. Local
variables and arrays must be in common blocks.
BLOCK DATA subprograms cannot contain RECORD declarations, whether they
are in common blocks or not.