Introduces a block data program unit.
Syntax
BLOCK DATA [block-data-name] |
- block-data-name
is an optional name. If a name is given in the END BLOCK DATA
statement terminating a block data program unit, it must be the
same as the block-data-name given in
the BLOCK DATA
statement introducing the program unit.
Description
A block data program unit is used to give initial values to
variables in a named common blocks by means of DATA
statements and must start with a BLOCK DATA
statement. The block data program unit is an obsolescent feature
of Fortran 90 and is effectively superseded by the module, as described
in “Modules”.
As an extension, HP Fortran 90 allows blank—or unnamed—common
blocks to be initialized.
Examples
The following block data program unit gives initial values
to variables in the common blocks cb1
and cb2. All
variables in each common block are specified completely.
BLOCK DATA REAL b(4) DOUBLE PRECISION z(3) COMPLEX c COMMON /cb1/c,a,b /cb2/z,y DATA b, z, c /1.0, 1.2 ,2*1.3, 3*7.654321D0, (2.4,3.76)/ END |
Related statements
COMMON,
DATA, and END
Related concepts
The structure and syntax of the block data program unit is
described in “Block data program unit”.