FORTRAN Reference Manual

Language Elements
FORTRAN Reference Manual528615-001
2-24
Equivalencing RECORD Fields
The following example shows a nested RECORD declaration that contains two
equivalenced subrecords:
RECORD dependent
RECORD depdata1
FILLER*5
RECORD depfields
CHARACTER*10 firstname
CHARACTER*20 lastname
CHARACTER*2 birthday
CHARACTER*2 birthmonth
CHARACTER*2 birthyear
END RECORD
END RECORD
RECORD depdata2
RECORD depkey
CHARACTER*5 employeenum
END RECORD
FILLER*36
END RECORD
EQUIVALENCE (depdata1, depdata2)
END RECORD
Equivalencing RECORD Fields
You can declare two or more fields in a RECORD that share the same storage by
referencing the items in an EQUIVALENCE declaration. The items need not be the
same data type. You can equivalence character and numeric variables only within a