## 4.17.2 Substructure Declarations in Structure Declarations

A field within a structure can itself be a structured item composed of other fields, other structures, or both. You can declare a substructure in two ways:

- By nesting structure declarations within other structure or union declarations (with the limitation that you cannot refer to a structure inside itself at any level of nesting).

  One or more field names must be defined in the STRUCTURE statement for the substructure because all fields in a structure must be named. In this case, the substructure is being used as a field within a structure or union.

  Field names within the same declaration nesting level must be unique, but an inner structure declaration can include field names used in an outer structure declaration without conflict.

  %FILL can be specified in place of a field name to leave space in a record for purposes such as alignment.

- By using a RECORD statement that specifies another previously defined record structure, thereby including it in the structure being declared.

See the second example in Section 4.17 for a sample structure containing both a nested structure declaration (TIME) and an included structure (DATE).

Previous Page Next Page Table of Contents