COBOL copybook types that map to Java data types
Because data in IMS is not strongly typed, you can use COBOL copybook types to map your IMS data to Java™ data types.
The following table describes how COBOL copybook types are mapped to both DLITypeInfo constants in the DLIDatabaseView class and Java data types.
Copybook format | DLITypeInfo constant | Java data type |
---|---|---|
PIC X | CHAR | java.lang.String |
PIC 9 BINARY1 | See DLITypeInfo constants and Java data types based on the PICTURE clause.2 |
See DLITypeInfo constants and Java data types based on the PICTURE clause.2 |
COMP-1 | FLOAT | float |
COMP-2 | DOUBLE | double |
PIC 9 COMP-33 | PACKEDDECIMAL | java.math.BigDecimal |
PIC 9 DISPLAY4 | ZONEDDECIMAL | java.math.BigDecimal |
Notes:
- Synonyms for BINARY data items are COMP and COMP-4. A
PIC 9(06)V99
statement with COMP or COMP-4 is used for binary decimal data. - For BINARY data items, the DLITypeInfo constant
and Java type depend on the
number of digits in the PICTURE clause.The table
DLITypeInfo constants and Java data types based on the PICTURE clause
describes the type based on PICTURE clause length. - PACKED-DECIMAL is a synonym for COMP-3.
- If the USAGE clause is not specified at either the group or elementary level, it is assumed to be DISPLAY.
The following table shows the DLITypeInfo constants and the Java data types based on the PICTURE clause.
Digits in PICTURE clause | Storage occupied | DLITypeInfo constant |
Java data type |
---|---|---|---|
1 through 2 | 1 byte | TINYINT |
byte |
1 through 4 | 2 bytes | SMALLINT |
short |
5 through 9 | 4 bytes | INTEGER |
int |
10 through 18 | 8 bytes | BIGINT |
long |
The following table shows examples of specific copybook formats mapped to DLITypeInfo constants.
Copybook format | DLITypeInfo constant |
---|---|
PIC X(25) | CHAR |
PIC 9(02) COMP | UTINYINT |
PIC S9(04) COMP | SMALLINT |
PIC 9(04) COMP | USMALLINT |
PIC S9(06) COMP-4 | INTEGER |
PIC 9(06) COMP-4 | UINTEGER |
PIC 9(06)V99 COMP or COMP-4 | BINARY |
PIC S9(12) BINARY | BIGINT |
PIC 9(12) BINARY | UBIGINT |
COMP-1 | FLOAT |
COMP-2 | DOUBLE |
PIC S9(06)V99 | ZONEDDECIMAL |
PIC 9(06).99 | ZONEDDECIMAL |
PIC S9(06)V99 COMP-3 | PACKEDDECIMAL |