The DEFINE STRUCTURE statement
specifies a named structure or union type.
 >>-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 the following attributes are allowed:
- The data attributes
- The INITIAL nondata attribute. For more information about the
INITIAL attribute, see INITIAL attribute.
- The VALUE nondata attribute. For more information about the VALUE
attribute, see Named constants.
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:
- defined structures must occupy a number of bytes that is a multiple
of the structure’s alignment
- in a defined structure, the number of bytes before the element
with the most stringent alignment must be a multiple of that element's
alignment
For example, if a structure contains
an aligned fixed bin(31) field as its most stringently aligned item,
then these restrictions say:
- the structure must occupy a multiple of 4 bytes
- there must be a multiple of 4 bytes before the first aligned
fixed bin(31) field
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".
- An unspecified structure cannot be dereferenced, but it may
be used to declare a HANDLE which, of course, cannot be dereferenced
either.
- An unspecified structure may also be the subject of a later
DEFINE STRUCTURE statement which does specifies its members.
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);
|
This information center is powered by Eclipse technology. (http://www.eclipse.org)