Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

Defining typed structures and unions

HANDLE attribute

The DEFINE STRUCTURE statement specifies a named structure or union type.

Read syntax diagramSkip visual syntax diagram>>-DEFINE--STRUCTURE--1--structure-type-name--+-------+--,------>
                                              '-UNION-'
 
   .-,-----------------------------------------.
   V                                           |
>----level minor-structure-name--+-----------+-+--;------------><
                                 '-attribute-'
 
structure-type-name
Specifies the name given to this structure type (see Structures for more information on major structures). This name cannot have dimensions, although substructures can.
UNION
Is discussed in UNION attribute.
minor-structure-name
Specifies the name given to a deeper level. (see Structures for more information on minor structures).
attributes
Specifies attributes for the minor-structure name. Only data attributes are allowed.

Any string lengths, area sizes, or array dimensions specified in a DEFINE STRUCTURE statement must be restricted expressions.

Missing data attributes are supplied using PL/I defaults.

Please note these restrictions:

For example, if a structure contains an aligned fixed bin(31) field as its most stringently aligned item, then these restrictions say:

The DEFINE STRUCTURE statement defines a "strong" type. In other words, variables declared with that type can only be assigned to variables (or parameters) having the same type. Typed structures can not be used in data-directed input/output statements.

A DEFINE STRUCTURE statement that merely names the structure to be defined without specifying any of its members defines an "unspecified structure".

Unspecified structure definitions are useful when a structure definition contains is a handle to a second structure which also contains is a handle to the first structure. For instance, in the following example, the parent structure contains a handle to the child structure, but the child structure also contains a handle to the parent structure.

   define structure 1 child;

   define structure
    1 parent,
      2 first_child   handle child,
      2 parent_data   fixed bin(31);

   define structure
    1 child,
      2 parent        handle parent,
      2 next_child    handle child,
      2 child_data    fixed bin(31);

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)