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.
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;
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. |
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. |
If the ordinal value of Color.RED is 0, the valid COBOL value is 0. |