The DEFINE ORDINAL statement specifies a named type representing a set of named ordered values.
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.
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.
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.
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));