COBOL to JSON schema mapping
The DFHLS2JS utility program supports mappings between COBOL data structures and JSON schema definitions.
- Duplicate names are made unique by the addition of one or more numeric digits.
For example, two instances of
yearbecomeyearandyear1. - Hyphens are replaced by underscores. Strings of contiguous hyphens are replaced by contiguous
underscores.
For example,
current-user--idbecomescurrent_user__id. - Segments of names that are delimited by hyphens and that contain only uppercase characters are
converted to lowercase.
For example,
CA-REQUEST-IDbecomesca_request_id. - A leading underscore is added to names that start with a numeric character.
For example,
9A-REQUEST-IDbecomes_9a_request_id.
- Data description items with level numbers of 66 and 77 are not supported. Data description items with a level number of 88 are ignored.
- The following clauses on data description entries are not supported:
- REDEFINES
- RENAMES; that is level 66
- DATE FORMAT
- The following clauses on data description items are ignored:
- BLANK WHEN ZERO
- JUSTIFIED
- VALUE
- The SIGN clause SIGN TRAILING is supported. The SIGN clause SIGN LEADING is supported only when the mapping level specified in DFHLS2JS is 1.2 or higher.
- SEPARATE CHARACTER is supported at a mapping level of 1.2 or higher for both SIGN TRAILING and SIGN LEADING clauses.
- The following phrases on the USAGE clause are not supported:
- OBJECT REFERENCE
- POINTER
- FUNCTION-POINTER
- PROCEDURE-POINTER
- The following phrases on the USAGE clause are supported at a mapping level of 1.2 or higher:
- COMPUTATIONAL-1
- COMPUTATIONAL-2
- The only PICTURE characters that are supported for DISPLAY and COMPUTATIONAL-5 data description items are 9, S, and Z.
- The PICTURE characters that are supported for PACKED-DECIMAL data description items are 9, S, V, and Z.
- The only PICTURE characters that are supported for edited numeric data description items are 9 and Z.
- If the MAPPING-LEVEL parameter is set to 1.2 or higher and the CHAR-VARYING parameter is set to
NULL, character arrays are mapped to a
stringand are processed as null-terminated strings. - If the MAPPING-LEVEL parameter is set to 1.2 or higher and the CHAR-VARYING parameter is set to
BINARY, character arrays are mapped to a
stringand are processed as binary data. - If the MAPPING-LEVEL parameter is set to 1.2 or higher and the CHAR-VARYING parameter is set to COLLAPSE, trailing white space is ignored for strings.
- The OCCURS DEPENDING ON clause is supported at a mapping level of 4.0 or higher. Complex OCCURS DEPENDING ON is not supported. This means that OCCURS DEPENDING ON is only supported for the last field of a structure.
- The OCCURS INDEXED BY clause is supported at any mapping level.
| COBOL data description | JSON schema definition |
|---|---|
|
|
PIC S9 DISPLAYPIC S99 DISPLAYPIC S999 DISPLAYPIC S9999 DISPLAY |
where n is the maximum value that can be represented by the pattern of '9'
characters. |
PIC 9 DISPLAYPIC 99 DISPLAYPIC 999 DISPLAYPIC 9999 DISPLAY |
where
n is the maximum value that can be represented by the pattern of '9' characters.
|
|
where: x is the minimum value that can be represented by the pattern of '9' characters y is the maximum value that can be represented by the pattern of '9' characters z is the smallest unit available = 1 / 10 n |
|
where: y is the maximum value that can be represented by the pattern of '9' characters z is the smallest unit available = 1 / 10 n |
DATETIME=PACKED15
|
The format of the time stamp is
defined by RFC3339. |
|
where: x is the minimum value that can be represented by the pattern of '9' characters y is the maximum value that can be represented by the pattern of '9' characters z is the smallest unit available = 1 / 10 n |
COMP-1Note: The IBM® Hexadecimal Floating Point
(HFP) data representation is not exactly the same as the IEEE-754-1985 representation used for JSON.
Some values might not convert exactly from one representation to the other.
Some extremely large or small values might not be valid for float data types. Some values might lose precision when converted to or from HFP representation. If precise conversions are important, consider replacing use of COMP-1 data types with fixed precision alternatives. |
|
COMP-2Note: The IBM Hexadecimal Floating Point
(HFP) data representation is not exactly the same as the IEEE-754-1985 representation used for JSON.
Some values might not convert exactly from one representation to the other.
Some extremely large or small values might not be valid for double data types. Some values might lose precision when converted to or from HFP representation. If precise conversions are important, consider replacing use of COMP-2 data types with fixed precision alternatives . |
|
data description
OCCURS
n
TIMES
|
|
|
data description OCCURSn TOm TIMESt |
The content of the array item depends on the datatype used. |
PIC X OCCURSn TIMESPIC A OCCURSn TIMESPIC G DISPLAY-1 OCCURSn TIMESPIC N OCCURSn TIMES |
When CHAR-OCCURS
This is a string. |
|
When CHAR-OCCURS
=ARRAY :
|
|
PIC X OCCURSn TOm TIMESt PIC A OCCURSn TOm TIMESt PIC G DISPLAY-1 OCCURSn TOm TIMESt PIC N OCCURSn TOm TIMESt |
When CHAR-OCCURS
|
PIC N(
n
) USAGE NATIONAL
When CHAR-USAGE
|
At mapping level 4.0 and higher:
At run time, CICS populates the application data structure field with UTF-16 data. |