8.3 Block Data Program Units

A block data program unit provides initial values for nonpointer variables in named common blocks. It takes the following form:

 [prefix] BLOCK DATA [name]
    [specification-part]
 END [BLOCK DATA [name]]
prefix
Is one of the following keywords:

Keyword [1]  Meaning 
EXTRINSIC(HPF)  Causes the procedure to execute in the single-threaded model known as "global HPF" -- essentially the standard Fortran model, but with some extensions and a few restrictions to allow for better parallelization. This is the default if no extrinsic prefix is specified (either explicitly or implicitly in the declaration of a host module or subprogram). 
EXTRINSIC(HPF_LOCAL)  Causes multiple independent copies of the same procedure to execute on different data on multiple processors. 
EXTRINSIC(HPF_SERIAL)  Causes the procedure to execute as if it were a single process executing on a scalar computer system. 

[1] These keywords are allowed on all platforms, but are functional only in parallel programs on Tru64 UNIX systems. For more information on EXTRINSIC keywords, see the Compaq High Performance Fortran 90 HPF and PSE Manual.

name
Is the name of the block data program unit.
specification-part
Is one or more of the following statements:

COMMON  INTRINSIC  STATIC 
DATA  PARAMETER  TARGET 
Derived-type definition  POINTER  Type declaration[2] 
DIMENSION  RECORD[1]  USE[3] 
EQUIVALENCE  Record structure declaration[1]   
IMPLICIT  SAVE   

[1] For more information on the RECORD statement and record structure declarations, see Section B.11.
[2] Can only contain attributes: DIMENSION, INTRINSIC, PARAMETER, POINTER, SAVE, STATIC, or TARGET.
[3] Allows access to only named constants.

Rules and Behavior

A block data program unit need not be named, but there can only be one unnamed block data program unit in an executable program.

If a name follows the END statement, it must be the same as the name specified in the BLOCK DATA statement.

An interface block must not appear in a block data program unit and a block data program unit must not contain any executable statements.

If a DATA statement initializes any variable in a named common block, the block data program unit must have a complete set of specification statements establishing the common block. However, all of the variables in the block do not have to be initialized.

A block data program unit can establish and define initial values for more than one common block, but a given common block can appear in only one block data program unit in an executable program.

The name of a block data program unit can appear in the EXTERNAL statement of a different program unit to force a search of object libraries for the block data program unit at link time.

Examples

The following is an example of a block data program unit:

BLOCK DATA BLKDAT
  INTEGER S,X
  LOGICAL T,W
  DOUBLE PRECISION U
  DIMENSION R(3)
  COMMON /AREA1/R,S,U,T /AREA2/W,X,Y
  DATA R/1.0,2*2.0/, T/.FALSE./, U/0.214537D-7/, W/.TRUE./, Y/3.5/
END

For More Information:


Previous Page Next Page Table of Contents