XML schema to COBOL mapping
The DFHSC2LS and DFHWS2LS utility programs support mappings between XML schema definitions and COBOL data structures.
-
COBOL reserved words are prefixed with '
X
'.For example,
DISPLAY
becomesXDISPLAY
. -
Characters other than A-Z, a-z, 0-9, or hyphen are replaced with '
X
'.For example,
monthly_total
becomesmonthlyXtotal
. You can use the MAPPING-OVERRIDES parameter to change the way other characters are handled. For example, if you set the value UNDERSCORES-AS-HYPHENS , any underscore in the XML is converted to a hyphen instead of an X. Somonthly_total
becomesmonthly-total
. -
If the last character is a hyphen, it is replaced with '
X
'.For example,
ca-request-
becomesca-requestX
. -
If the schema specifies that the variable has varying cardinality
(that is,
minOccurs
andmaxOccurs
are specified on anxsd:element
with different values), and the schema element name is longer than 23 characters, it is truncated to that length.If the schema specifies that the variable has fixed cardinality and the schema element name is longer than 28 characters, it is truncated to that length.
-
Duplicate names in the same scope are made unique by the addition
of one or two numeric digits
to the second and subsequent instances of the name.
For example, three instances of
year
becomeyear
,year1
, andyear2
.Should the above behavior be undesirable the user can specify
MAPPING-OVERRIDES=NO-ARRAY-NAME-INDEXING
as input to the utility which disables the addition of one or two numeric digits to the second and subsequent instances of the name. -
Five characters are reserved for the strings
-cont
or-num
, which are used when the schema specifies that the variable has varying cardinality; that is, whenminOccurs
andmaxOccurs
are specified with different values.For more information, see Variable arrays of elements.
-
For attributes, the previous rules are applied to the element
name. The prefix
attr-
is added to the element name, and is followed by-value
or-exist
. If the total length is longer than 28 characters, the element name is truncated. For more information, see Support for XML attributes.The nillable attribute has special rules. The prefix
attr-
is added, butnil-
is also added to the beginning of the element name. The element name is followed by-value
. If the total length is longer than 28 characters, the element name is truncated.
- If the MAPPING-LEVEL parameter is set to 1.2 or higher and the CHAR-VARYING parameter is set to NULL, variable-length character data is mapped to null-terminated strings and an extra character is allocated for the null-terminator.
-
If the
MAPPING-LEVEL
parameter is set to 1.2 or higher and the
CHAR-VARYING
parameter is set to YES, variable-length character data is mapped
to two related elements: a length field and a data field. For
example:
maps to:<xsd:simpleType name="VariableStringType"> <xsd:restriction base="xsd:string"> <xsd:minLength value="1"/> <xsd:maxLength value="10000"/> </xsd:restriction> </xsd:simpleType> <xsd:element name="textString" type="tns:VariableStringType"/>
15 textString-length PIC S9999 COMP-5 SYNC 15 textString PIC X(10000)
Schema simple type | COBOL data description |
---|---|
|
Mapping level 2.0 and below: Not supported
Mapping level 2.1: Supported
|
|
Mapping level 1.0: Not supported
Mapping level 1.1 and higher: PIC X(255) |
where
type is one of:
|
All mapping levels:
|
where
type is one of:
|
When CCSID=1200 at mapping level 4.0 and higher:
|
where type is one of:
|
All mapping levels: PIC X(32) |
|
Mapping level 1.2 and below: PIC X(32) Mapping level 2.0 and higher: PIC X(40) Mapping level 3.0 and higher: PIC S9(15) COMP-3 The format is CICS ABSTIME. |
where
type is one of:
|
All mapping levels: PIC X DISPLAY |
|
All mapping levels: PIC S9999 COMP-5 SYNC or
PIC S9999
DISPLAY
|
|
All mapping levels: PIC 9999 COMP-5 SYNC or
PIC 9999 DISPLAY
|
|
All mapping levels: PIC S9(18) COMP-3 |
|
All mapping levels: PIC S9(9) COMP-5 SYNC or
PIC S9(9) DISPLAY
|
|
All mapping levels: PIC 9(9) COMP-5 SYNC or
PIC 9(9) DISPLAY
|
|
All mapping levels: PIC S9(18) COMP-5 SYNC or
PIC S9(18) DISPLAY
|
|
All mapping levels: PIC 9(18) COMP-5 SYNC or
PIC 9(18) DISPLAY
|
|
All mapping levels:
If WIDE-COMP3=FULL:
Otherwise:
where p = m - n. |
|
All mapping levels: PIC X DISPLAY |
|
Mapping level 1.0: Not supported
Mapping level 1.1 and higher: PIC X(255) |
|
Mapping level 1.0: Not supported
Mapping level 1.1 and higher: PIC X(255) |
where the length is not defined. |
Mapping level 1.0: Not supported
Mapping level 1.1:
where y =4×(ceil( z /3)). ceil( x ) is the smallest integer greater than or equal to x. Mapping level 1.2 and higher:
PIC X(16) |
|
Mapping level 1.1 and below: PIC X(32) Mapping level 1.2 and higher: COMP-1 Note:
The
IBM®
Hexadecimal Floating Point (HFP) data representation
is not exactly the same as the IEEE-754-1985 representation that
is
used for XML. Some values might not convert exactly from one
representation
to the other. Some extremely large or small values might not be
valid
for
xsd: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.
|
|
Mapping level 1.1 and below: PIC X(32) Mapping level 1.2 and higher: COMP-2 Note:
The
IBM
Hexadecimal Floating Point (HFP) data representation
is not exactly the same as the IEEE-754-1985 representation that
is
used for XML. Some values might not convert exactly from one
representation
to the other. Some extremely large or small values might not be
valid
for
xsd: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.
|
Some of the schema types shown in the table map to a COBOL format of
COMP-5 SYNC or of DISPLAY,
depending on the values (if any) that are specified in the
minInclusive
and
maxInclusive
facets:
- For signed types (
short
,int
, andlong
), DISPLAY is used when the following are specified:
where<xsd:minInclusive value="-a"/> <xsd:maxInclusive value="a"/>
a
is a string of '9's. - For unsigned types (
unsignedShort
,unsignedInt
, andunsignedLong
), DISPLAY is used when the following are specified:
where<xsd:minInclusive value="0"/> <xsd:maxInclusive value="a"/>
a
is a string of '9's.
When any other value is specified, or no value is specified, COMP-5 SYNC is used.