PL/I to JSON schema mapping
The DFHLS2JS utility program supports mappings between PL/I data structures and JSON schema definitions. Because the Enterprise PL/I compiler and older PL/I compilers differ, two language options are supported: PLI-ENTERPRISE and PLI-OTHER.
- Characters that are not valid in JSON property names are replaced
with '
x
'.For example,
monthly$total
becomesmonthlyxtotal
. - Duplicate names are made unique by the addition of one or more
numeric digits.
For example, two instances of
year
becomeyear
andyear1
.
- Data items with the COMPLEX attribute are not supported.
- Data items with the FLOAT attribute are supported at a mapping level of 1.2 or higher. Enterprise PL/I FLOAT IEEE is not supported.
- VARYING and VARYINGZ pure DBCS strings are supported at a mapping level of 1.2 or higher.
- Data items that are specified as DECIMAL(p,q) are supported only when p ≥ q
- Data items that are specified as BINARY(p,q) are supported only when q = 0.
- If the PRECISION attribute is specified for a data item, it is ignored.
- PICTURE strings are not supported.
- ORDINAL data items are treated as FIXED BINARY(7) data types.
- 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 an
string
and are processed as null-terminated strings; this mapping does not apply for Enterprise PL/I. - 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
string
and 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, leading and trailing white space will be removed and multiple spaces are replaced with a single space.
3 FIELD1 FIXED BINARY(7),
3 FIELD2 FIXED BINARY(31),
3 FIELD3 FIXED BINARY(63);
In this example:- FIELD1 is 1 byte long and can be aligned on any boundary.
- FIELD2 is 4 bytes long and must be aligned on a fullword boundary.
- FIELD3 is 8 bytes long and must be aligned on a doubleword boundary.
- FIELD3 is aligned first because it has the strongest boundary requirements.
- FIELD2 is aligned at the fullword boundary immediately before FIELD3.
- FIELD1 is aligned at the byte boundary immediately before FIELD3.
3 PAD1 FIXED BINARY(7),
3 PAD2 FIXED BINARY(7),
3 PAD3 FIXED BINARY(7),
3 FIELD1 FIXED BINARY(7),
3 FIELD2 FIXED BINARY(31),
3 FIELD3 FIXED BINARY(63);
Alternatively, you can change
the structure to declare all the fields as unaligned and recompile
the application that uses the structure. For more information about
PL/I structural memory alignment requirements, refer to Enterprise
PL/I Language Reference. PL/I data description | JSON schema definition |
---|---|
FIXED BINARY (n) |
where n is the maximum value that can
be represented by the primitive. |
UNSIGNED FIXED BINARY(n) Restriction: Enterprise PL/I only
|
where n is the maximum value that can
be represented by the primitive. |
FIXED DECIMAL(n,m) |
where: x is the smallest unit available = 1 / 10m y is the maximum value that can be represented by the combination of n and m z is the maximum value that can be represented by the combination of n and m |
FIXED DECIMAL(15) Supported at mapping level 3.0 and higher when DATETIME=PACKED15 |
The format of the time stamp is defined by RFC3339. |
BIT(n) |
where m = n/8 |
CHARACTER(n)
Restriction:
VARYINGZ is supported only by
Enterprise PL/I |
|
GRAPHIC(n)
Restriction:
VARYINGZ is supported only by
Enterprise PL/I |
At a mapping level of 1.0 and 1.1, where m =
2*n :
At a mapping level of 1.2 or higher:
|
WIDECHAR(n) Restriction: Enterprise PL/I only
|
At a mapping level of 1.0 and 1.1, where m =
2*n :
At a mapping level of 1.2 or higher:
At mapping level 4.0 and higher, CICS® populates the application data structure field with UTF-16 data.
|
ORDINAL Restriction: Enterprise
PL/I only
|
|
BINARY FLOAT(n) where n <=
21 Supported at mapping level 1.2 and higher. Note: The IBM® Hexadecimal
Floating Point (HFP) data representation is not exactly the same as
the IEEE-754-1985 representation used for JSON. Some values may 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 may lose precision when converted to or from HFP representation.
If precise conversions are important, consider replacing use of BINARY
FLOAT data types with fixed precision alternatives.
|
|
BINARY FLOAT(n) where 21
< n <= 53 Values greater than 53 are not supported. Supported at mapping level 1.2 and higher. Note: The IBM Hexadecimal
Floating Point (HFP) data representation is not exactly the same as
the IEEE-754-1985 representation used for JSON. Some values may 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 may lose precision when converted to or from HFP representation.
If precise conversions are important, consider replacing use of BINARY
FLOAT data types with fixed precision alternatives.
|
|
DECIMAL FLOAT(n) where n <=
6 Supported at mapping level 1.2 and higher. Note: The IBM Hexadecimal
Floating Point (HFP) data representation is not exactly the same as
the IEEE-754-1985 representation used for JSON. Some values may 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 may lose precision when converted to or from HFP representation.
If precise conversions are important, consider replacing use of DECIMAL
FLOAT data types with fixed precision alternatives.
|
|
DECIMAL FLOAT(n) where 6
< n <= 16 Values greater than 16 are not supported. Supported at mapping level 1.2 and higher. Note: The IBM Hexadecimal
Floating Point (HFP) data representation is not exactly the same as
the IEEE-754-1985 representation used for JSON. Some values may 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 may lose precision when converted to or from HFP representation.
If precise conversions are important, consider replacing use of DECIMAL
FLOAT data types with fixed precision alternatives.
|
|
name (n) data description | For primitives: For data declarations:
Where data description JSON is the JSON schema representation of the PL/I data description. |