HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
STRUCTURE (extension)
Chapter 10 465
STRUCTURE (extension)
Defines a named structure.
Syntax
STRUCTURE /
struct-name
/
field-def
...
END STRUCTURE
struct-name
is the structure’s name, delimited by slashes.
struct-name
can be used
later to declare a record.
field-def
is a field definition.
Description
HP Fortran supports the STRUCTURE statement as a compatibility extension. New programs
should use the derived type, a standard feature of Fortran 90; derived types provide the same
functionality as named structures. For more information about derived types, see “Derived
types” on page 123 and “TYPE (declaration)” on page 481.
The STRUCTURE statement defines the type, size, and layout of a structure’s fields, and assigns
a name to the structure. Once a structure is defined, you can declare records of that structure
using the RECORD statement and can manipulate the record’s fields.
A structure definition pertains only to the program unit in which it is defined. For example,
you cannot define a structure in the main program unit and then declare a record of that
structure in a subprogram unit. Instead, the structure must be explicitly defined again in the
subprogram unit.
field-def
can be any of the following:
A type declaration statement
A nested structure definition
A nested record declaration
A union definition
Each type of field definition is described in the remaining sections.
Field definition as type declaration