Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 7 Program units and procedures

Block data program unit

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

A block data program unit initializes data values in common blocks. The syntax of a block data program unit is:

BLOCK DATA [block-data-name]
[specification-part]
END [BLOCK DATA [block-data-name]]
block-data-name

is the name of the block data program unit. Note that the name is optional. If omitted, no more than one unnamed block data program unit may appear in an executable program.

specification-part

is zero or more of the following:

  • Type declaration statement

  • USE statement

  • IMPLICIT statement

  • COMMON statement

  • DATA statement

  • EQUIVALENCE statement

  • Derived-type definition

  • The following attribute-specification statements:

    • DIMENSION

    • INTRINSIC

    • PARAMETER

    • POINTER

    • SAVE

    • TARGET

If a USE statement appears in a block data program unit, it makes only the named constants accessible to the program unit.

The block data program unit can initialize more than one common block. However, a common block can be initialized in only one block data program unit. It is not necessary to initialize every object within the common block, but the common block must be completely specified.

As an extension, HP Fortran allows the initialization of objects in blank—or unnamed—common. The following example illustrates this extension:

BLOCK DATA blank
COMMON//aa(3),ab(5) ! an unnamed common block
DATA aa/3*1.0/
DATA ab/1.0,2.0,3*4.0/
END BLOCK DATA blank
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.