XL Fortran for AIX 8.1

Language Reference


Block Data Program Unit

A block data program unit provides initial values for objects in named common blocks.



>>-BLOCK_DATA_statement----------------------------------------><
 
 
>>-+--------------------+--------------------------------------><
   '-specification_part-'
 
 
>>-END_BLOCK_DATA_statement------------------------------------><
 
 

BLOCK_DATA_statement
See BLOCK DATA for syntax details

specification_part
is a sequence of statements from the statement groups numbered (2), (3), and (4) in Order of Statements and Execution Sequence

END_BLOCK_DATA_statement
See END for syntax details

In specification_part, you can specify type declaration, USE, IMPLICIT, COMMON, DATA, EQUIVALENCE, and integer POINTER statements, derived-type definitions, and the allowable attribute specification statements. The only attributes that can be specified include PARAMETER, DIMENSION, INTRINSIC, POINTER, SAVE, and TARGET.

A type declaration statement in a block data specification-part shall not contain ALLOCATABLE or EXTERNAL attribute specifiers.

You can have more than one block data program unit in an executable program, but only one can be unnamed. You can also initialize multiple named common blocks in a block data program unit.

Restrictions on common blocks in block data program units are:

Example of a Block Data Program Unit

PROGRAM MAIN
  COMMON /L3/ C, X(10)
  COMMON /L4/ Y(5)
END PROGRAM
BLOCK DATA BDATA
  COMMON /L3/ C, X(10)
  DATA C, X /1.0, 10*2.0/   ! Initializing common block L3
END BLOCK DATA
 
BLOCK DATA                  ! An unnamed block data program unit
  PARAMETER (Z=10)
  DIMENSION Y(5)
  COMMON /L4/ Y
  DATA Y /5*Z/
END BLOCK DATA


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]