The record structure was defined in earlier versions of Compaq Fortran as a language extension. It is still supported in Visual Fortran, although its functionality has been replaced by standard Fortran 95/90 derived types. Record structures in existing code can be easily converted to Fortran 95/90 derived type structures for portability, but can also be left in their old form. In most cases, a Compaq Fortran record and a Fortran 95/90 derived type can be used interchangeably.
Compaq Fortran record structures are similar to Fortran 95/90 derived types.
A record structure is an aggregate entity containing one or more elements. (Record elements are also called fields or components.) You can use records when you need to declare and operate on multi-field data structures in your programs.
Creating a record is a two-step process:
Examples
Compaq Fortran record structures, using only intrinsic types, easily convert to Fortran 95/90 derived types. The conversion can be as simple as replacing the keyword STRUCTURE with TYPE and removing slash ( / ) marks. The following shows an example conversion:
Record Structure | Fortran 95/90 Derived-Type |
---|---|
|
|
employee_data
record. The equivalent Fortran
90 derived type would use the derived-type objects as components in a similar
manner, as shown below:
Record Structure | Fortran 95/90 Derived-Type |
---|---|
|
|