The Enum-ID paragraph indicates that this Identification Division introduces a enumeration definition and specifies the name
that identifies the enumeration.
General Format
Syntax Rules
- An enum program consists only of an optional environment division and a data division.
- The environment division, if specified, must include only a repository paragraph and a class-attributes paragraph
- The data division must include only a working-storage section which has:
- an optional 01 level item of type, e.g. BINARY-LONG or BINARY-DOUBLE. The type of this item determines the underlying type
of the enum. If no such 01 level item is specified, the underlying type is BINARY-LONG.
- any number of level 78 items, for which the VALUE clause may be omitted. If the VALUE clause is present, it must specify
an integer literal. If omitted, the value is assumed to be 1 if this is the first item, and for subsequent items 1 more than
the previous value.
- The enum definition may be terminated with END ENUM enumeration-name.
- Attribute-clause is defined in the topic on the
Attribute,
Custom-Attribute Clause.
General Rules
- The attributes clause is used to assign any
attributes to the enum (for instance the Flags attribute, which indicates that the enum is to be regarded as a set of bit
settings).
- If a 01 level item is specified, the type of this item determines the underlying type of the enum. If no 01 level item is
specified, the underlying type is BINARY-LONG.
- Each level 78 item specifies an enum member with the same name and value
- In .NET, but not JVM, you need to set the attribute System.FlagsAttribute. This attribute applied to an enum means that the
distinct values are to be regarded as bit settings, and can therefore be combined.