The Enum-ID Paragraph

General Format


ENUM-ID

Syntax Rules

  1. An enum program consists only of an optional environment division and a data division.
  2. The environment division, if specified, must include only a repository paragraph and a class-attributes paragraph
  3. 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.
  4. The enum definition may be terminated with END ENUM enumeration-name.

General Rules

  1. The class-attributes paragraph is used to assign any custom attributes to the enum (for instance the Flags attribute, which indicates that the enum is to be regarded as a set of bit settings).
  2. 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.
  3. Each level 78 item specifies an enum member with the same name and value