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

DEFINE ORDINAL statement

The DEFINE ORDINAL statement specifies a named type representing a set of named ordered values.

Read syntax diagramSkip visual syntax diagram>>-DEFINE ORDINAL--ordinal-type-name---------------------------->
 
>--(--| ordinal-value-list |--)--+----------------------+------->
                                 '-PRECISION--(integer)-'
 
>--+----------+--;--| ordinal-value-list: |--------------------->
   +-SIGNED---+
   '-UNSIGNED-'
 
   .-,--------------------------.
   V                            |
>----member--+----------------+-+------------------------------><
             '-VALUE(integer)-'
 
ordinal-type-name
Ordinal-type-name specifies the name of the set of ordinal values. This name can be used only in DECLARE statements with the ORDINAL attribute. Use of this name elsewhere results in it being treated as any other nonordinal name.
member
Specifies the name of a member within the set.
VALUE
The VALUE attribute specifies the value of a particular member within the set. If the VALUE attribute is omitted for the first member, a value of zero is used. If the VALUE attribute is omitted for any other member, the next greater integer value is used.

The value in the given (or assumed) VALUE attribute must be an integer, can be signed, and must be strictly increasing. The value in the given (or assumed) VALUE attributed may also be specified as an XN constant.

PRECISION
Abbreviation: PREC

The PRECISION attribute specifies the precision of a particular ordinal value. If omitted, the precision is determined by the range of ordinal values.

The maximum precision is the same as that for data items declared FIXED BINARY.

SIGNED or UNSIGNED
These attributes indicate whether ordinal values can assume negative values. If omitted, they are determined by the range of ordinal values. For example, if any value is negative, the SIGNED attribute is applied.

For more information on SIGNED and UNSIGNED, refer to SIGNED and UNSIGNED attributes.

In the following example, Red has the value 0, Orange has the value 1, etc. But Low has the value 2 and Medium has the value 3.

Example

  define ordinal Color ( Red,          /* is 0, since VALUE is omitted */
                         Orange,
                         Yellow,
                         Green,
                         Blue,
                         Indigo,
                         Violet );

  define ordinal Intensity ( Low    value(2),
                             Medium,
                             High   value(5));

Terms of use | Feedback

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