The Block Data statement is the first line that appears in a block data program unit. The block data construct is then used to provide initial values to variables that appear in named common blocks within the program. Please note that the block data statement can either be named or unnamed.
The discussion of the block data statement would not be complete without an overall description of the block data program unit and the rules that govern its use. The important things to remember are listed below
First, a block data unit can be either named or unnamed. A unnamed block data unit would start out with only the block data statement like so:
On the other hand, a named block data unit would have the block data statement and then a name following the block data statement. This would simply look like the following:
block data first
The actual declaration and initialization of variables inside the block data unit is not unlike what might be done for other variables in the main program. Although, make sure that the names of the common blocks that are going to be initialized appear after the block data statement. Then, at the end of the block would be an end statement. Therefore, an entire block data unit might appear like the following.
Block data first common/global/ x(15),g,n common/misc/ldata,lmax,lmin real x(15),g,n integer ldata,lmax,lmin data g,n,x/9.81,6.02e23,15*3.0/ data lmin,lmax/1,100/ end block data first
lecture thirty eight
Written by Jason Wehr : firstname.lastname@example.org and Maintained by John Mahaffy : email@example.com