FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-23
RECORD Storage
The following example includes references to fields in the employee RECORD:
CHARACTER*10 emp_name
REAL emp_pay
INTEGER emp_dept
emp_name = employee^name
emp_pay = employee^pay <-- Error: Not fully qualified
emp_pay = employee^salary^pay
emp_dept = employee^salary^dept
emp_temp = employee^filler <-- Error: Cannot refer to FILLER
RECORD Storage
FORTRAN allocates the fields of a RECORD in the order in which they appear in the
RECORD declaration. It allocates to each field the amount of storage required by the
field’s type. If the field is an array, the amount of storage is the size of an element of
the array multiplied by the number of elements in the array. A field of type character or
RECORD is allocated beginning at the next free byte. A field of type logical or numeric
is aligned at the next word boundary. If a RECORD itself is dimensioned and contains
at least one field of type logical or numeric, FORTRAN ensures that the record starts at
an even-byte address. A RECORD at the outermost level always begins on a word
boundary.
Equivalencing RECORDs
You can equivalence RECORDs only to other RECORDs. You can use an
EQUIVALENCE statement:
Within a RECORD declaration to equivalence any data items at the same nesting
level as the EQUIVALENCE statement.
Outside a RECORD declaration, to equivalence RECORDs only at their outermost
level.