24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>FORTRAN</strong> Statements<br />

2.8 BLOCK DATA Statement<br />

<br />

BLOCK DATA [sub]<br />

where:<br />

sub<br />

is an optional symbolic name of the block data subprogram and must not be the name of an<br />

external procedure, main program, common block, other block data subprogram, or any local<br />

name in the block data subprogram.<br />

The BLOCK DATA statement is used to define the start of a block data subprogram. A block data<br />

subprogram is used to provide initial values for variables and array elements in named common blocks.<br />

The only statements which are allowed to appear in a block data subprogram are:<br />

1. IMPLICIT<br />

2. PARAMETER<br />

3. DIMENSION<br />

4. COMMON<br />

5. SAVE<br />

6. EQUIVALENCE<br />

7. DATA<br />

8. STRUCTURE, END STRUCTURE<br />

9. UNION, END UNION<br />

10. MAP, END MAP<br />

11. RECORD<br />

12. END<br />

13. type statements<br />

Example:<br />

BLOCK DATA INITCB<br />

DIMENSION A(10), B(10)<br />

COMMON /CB/ A, B<br />

DATA A/10*1.0/, B/10*2.0/<br />

END<br />

In the above example, the arrays A and B in the named common block CB are initialized.<br />

Notes:<br />

1. More than one named common block may appear in a block data subprogram.<br />

2. All entities of the named common block(s) must be specified.<br />

3. Not all entities need be given initial values.<br />

4. Only entities that appear in (or are associated, through the EQUIVALENCE statement, with<br />

entries in) a named common block may be given initial values.<br />

5. Only one unnamed block data subprogram may occur in an executable program.<br />

BLOCK DATA Statement 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!