BLOCK DATA Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
BLOCK DATA Statement (Nonexecutable)
The BLOCK DATA statement identifies the beginning of a block data
subprogram.
-----------------------------------------------------------------------------------------------
| | | |
| Item | Description/Default | Restrictions |
| | | |
-----------------------------------------------------------------------------------------------
| | | |
| subprogram_name | Subprogram name. | Must not be the same as the name |
| | | of an external procedure, the main |
| | | program, a common block, or any |
| | | other block data subprogram in the |
| | | same execution program, nor can it |
| | | be the same as any local name in |
| | | this block data subprogram. |
| | | |
-----------------------------------------------------------------------------------------------
Semantics
Block data subprograms provide initial values for variables and array
elements in labeled common blocks.
Block data subprograms define the size and reserve storage space for each
labeled common block and, optionally, initialize the variables, records,
and arrays declared in the common block. A block data subprogram begins
with a BLOCK DATA statement. It ends with an END statement.
The BLOCK DATA statement must be the first noncomment statement in a
block data subprogram. Each named common block referenced in an
executable FORTRAN program can be defined in a block data subprogram.
Specification statements, data initialization statements, and blank
common statements are allowed in the body of a block data subprogram.
Acceptable statements include the COMMON, DATA, DIMENSION, END MAP, END
STRUCTURE, END UNION, IMPLICIT, MAP, PARAMETER, RECORD, SAVE, STRUCTURE,
and UNION statements, and all explicit type statements (such as INTEGER*4
or REAL*8). EXTERNAL and INTRINSIC statements are not allowed.
The block data subprogram without a name is treated the same as a named
block data subprogram. However, there cannot be more than one unnamed
block data subprogram in the same program. If a program contains more
than one unnamed block data subprogram, the results are unpredictable.
Example Notes
---------------------------------------------------------------------------------------
BLOCK DATA myblock myblock is the optional name of a block
COMMON /xxx/x(5),b(10),c data subprogram to reserve storage
COMMON /set1/iy(10) locations for the named common blocks xxx
DATA iy/1,2,4,8,16,32,64,128,256,512/ and set1. Arrays iy and b are initialized
DATA b/10*1.0/ in the DATA statements shown. The
: remaining elements in the common block can
END optionally be initialized or typed in the
block data subprogram.
BLOCK DATA name1 name1 is the optional name of a block data
COMMON a,b,c subprogram to reserve storage locations for
DATA a,b,c/10.0,20.0,30.0/ the blank common block. The real variables
END a, b, and c are initialized as shown in the
DATA statement.
MPE/iX 5.0 Documentation