Previous Topic Next topic Print topic


NETJVM 

The Enum-ID Paragraph

The Enum-ID paragraph indicates that this Identification Division introduces a enumeration definition and specifies the name that identifies the enumeration.

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.
  5. Attribute-clause is defined in the topic on the Custom-Attribute Clause.

General Rules

  1. The attributes clause 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
  4. 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.
Previous Topic Next topic Print topic