Enum type

The enum data type in Java™ is supported when Java types map to COBOL structures. You can specify that it maps to the PIC X type or the PIC 9 type in COBOL.

Suppose that your rule project has the following Java XOM that contains the enum type:
public enum Color{
RED, YELLOW, GREEN
}

public Painter{
private Color color;
private ......
}
The corresponding BOM has the following domain class:
domain {static RED, static YELLOW, static GREEN}

public static final readonly sample.tools.domain.Color RED;
public static final readonly sample.tools.domain.Color YELLOW;
public static final readonly sample.tools.domain.Color GREEN;
You can choose one of the following options when you map the enum data type:
Table 1. Mapped COBOL types
Mapped COBOL type Descriptions Examples

PIC X(n)

The value of each COBOL element corresponds to the name of the enum element that is defined in the Java enum type.

The value n is automatically calculated. It corresponds to the maximum length of characters in the Java enum type.

01 PAINTER.
   05 color pic x(6) value space.

If the name of an enum element Color.RED is "RED", the corresponding value in COBOL is "RED".

PIC 9(n)

The valid value of each COBOL element corresponds to the ordinal order that is defined in the Java enum type.

The value n is automatically calculated. It corresponds to the ordinal order that is defined in the Java enum type.

01 PAINTER.
   05 color pic 9 value space. 

If the ordinal value of Color.RED is 0, the valid COBOL value is 0.

Note: Valid COBOL values that correspond to the Java enum type are commented in the generated COBOL copybook for your reference. A runtime exception occurs if you use an invalid COBOL value.