COBOL to XML schema mapping

The DFHLS2SC and DFHLS2WS utility programs support mappings between COBOL data structures and XML schema definitions.

COBOL names are converted to XML names according to the following rules:
  1. Duplicate names are made unique by the addition of one or more numeric digits.

    For example, two instances of year become year and year1.

  2. Hyphens are replaced by underscore characters. Strings of contiguous hyphens are replaced by contiguous underscores.

    For example, current-user--id becomes current_user__id.

  3. Segments of names that are delimited by hyphens and that contain only uppercase characters are converted to lowercase.

    For example, CA-REQUEST-ID becomes ca_request_id.

  4. A leading underscore character is added to names that start with a numeric character.

    For example, 9A-REQUEST-ID becomes _9a_request_id.

CICS® maps COBOL data description elements to schema elements according to the following table. COBOL data description elements that are not shown in the table are not supported by DFHLS2SC or DFHLS2WS. The following restrictions also apply:
  • 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 DFHLS2SC or DFHLS2WS 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 an xsd:string and 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 xsd:base64Binary 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, trailing white space is ignored for strings.
  • Start of changeThe 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.End of change
  • Start of changeThe OCCURS INDEXED BY clause is supported at any mapping level.End of change
  • The OCCURS clause is supported up to 65535 TIMES of occurrences. This means OCCURS n TIMES where n is greater than 65535 is not supported.
COBOL data description Schema simpleType
PIC X(n)
PIC A(n)
PIC G(n) DISPLAY-1
PIC N(n)
<xsd:simpleType>
  <xsd:restriction base="xsd:string">
    <xsd:maxlength value="n"/>
    <xsd:whiteSpace value="preserve"/>
  </xsd:restriction>
</xsd:simpleType>
PIC S9 DISPLAY
PIC S99 DISPLAY
PIC S999 DISPLAY
PIC S9999 DISPLAY
<xsd:simpleType>
  <xsd:restriction base="xsd:short">
    <xsd:minInclusive value="-n"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType> 
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC S9(z) DISPLAY
where 5 ≤ z ≤ 9
<xsd:simpleType>
  <xsd:restriction base="xsd:int">
    <xsd:minInclusive value="-n"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC S9(z) DISPLAY
where 9 < z
<xsd:simpleType>
  <xsd:restriction base="xsd:long">
    <xsd:minInclusive value="-n"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC 9 DISPLAY
PIC 99 DISPLAY
PIC 999 DISPLAY
PIC 9999 DISPLAY
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedShort">
    <xsd:minInclusive value="0"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC 9(z) DISPLAY
where 5 ≤ z ≤ 9
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedInt">
    <xsd:minInclusive value="0"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC 9(z) DISPLAY
where 9 < z
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedLong">
    <xsd:minInclusive value="0"/>
    <xsd:maxInclusive value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where n is the maximum value that can be represented by the pattern of '9' characters.
PIC S9(n) COMP
PIC S9(n) COMP-4
PIC S9(n) COMP-5
PIC S9(n) BINARY
where n ≤ 4.
<xsd:simpleType>
  <xsd:restriction base="xsd:short">
  </xsd:restriction>
</xsd:simpleType>
PIC S9(n) COMP
PIC S9(n) COMP-4
PIC S9(n) COMP-5
PIC S9(n) BINARY
where 5 ≤ n ≤ 9.
<xsd:simpleType>
  <xsd:restriction base="xsd:int">
  </xsd:restriction>
</xsd:simpleType>
PIC S9(n) COMP
PIC S9(n) COMP-4
PIC S9(n) COMP-5
PIC S9(n) BINARY
where 9 <n.
<xsd:simpleType>
  <xsd:restriction base="xsd:long">
  </xsd:restriction>
</xsd:simpleType>
PIC 9(n) COMP
PIC 9(n) COMP-4
PIC 9(n) COMP-5
PIC 9(n) BINARY
where n ≤ 4.
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedShort">
  </xsd:restriction>
</xsd:simpleType>
PIC 9(n) COMP
PIC 9(n) COMP-4
PIC 9(n) COMP-5
PIC 9(n) BINARY
where 5 ≤ n ≤ 9.
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedInt">
  </xsd:restriction>
</xsd:simpleType>
PIC 9(n) COMP
PIC 9(n) COMP-4
PIC 9(n) COMP-5
PIC 9(n) BINARY
where 9 <n.
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedLong">
  </xsd:restriction>
</xsd:simpleType>
PIC S9(m)V9(n) COMP-3
<xsd:simpleType>
  <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="p"/>
    <xsd:fractionDigits value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where p = m + n.

PIC 9(m)V9(n) COMP-3

<xsd:simpleType>
  <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="p"/>
    <xsd:fractionDigits value="n"/>
    <xsd:minInclusive value="0"/>
  </xsd:restriction>
</xsd:simpleType>
where p = m + n.

PIC S9(m) COMP-3

Supported at mapping level 3.0 when DATETIME=PACKED15

<xsd:simpleType>
  <xsd:restriction base="xsd:dateTime"
  </xsd:restriction>
</xsd:simpleType>
The format of the time stamp is CICS ABSTIME.
PIC S9(m)V9(n) DISPLAY

Supported at mapping level 1.2 and higher

<xsd:simpleType>
  <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="p"/>
    <xsd:fractionDigits value="n"/>
  </xsd:restriction>
</xsd:simpleType>
where p = m + n.
COMP-1

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 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.
<xsd:simpleType>
  <xsd:restriction base="xsd:float">
  </xsd:restriction>
</xsd:simpletype>
COMP-2

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 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.
<xsd:simpleType>
  <xsd:restriction base="xsd:double">
  </xsd:restriction>
</xsd:simpletype>
Start of changedata description OCCURS n TIMESEnd of change Start of change
<xsd:element name="field-name" minOccurs="n" maxOccurs="n">
      ...
</xsd:element>

The content of the element depends on the data type used.

End of change
Start of change
data description OCCURS n TO m TIMES
DEPENDING ON
t

Supported at mapping level 4.0

End of change
Start of change
<xsd:element name="field-name" minOccurs="n" maxOccurs="m">
      ...
</xsd:element>
End of change
Start of change
PIC X OCCURS n TIMES
PIC A OCCURS n TIMES
PIC G DISPLAY-1 OCCURS n TIMES
PIC N OCCURS n TIMES
End of change
Start of change

When CHAR-OCCURS=STRING:

<xsd:element name="field-name" >
      <xsd:simpleType>
            <xsd:restriction base="s:string">
                  <xsd:maxLength value="n">
            </xsd:restriction>
      </xsd:simpleType>
</xsd:element>

This is a string.

When CHAR-OCCURS=ARRAY:

<xsd:element name="field-name" minOccurs="n" maxOccurs="n">
      <xsd:simpleType>
            <xsd:restriction base="s:string">
                  <xsd:maxLength value="1"
            </xsd:restriction>  
      </xsd:simpleType> 
</xsd:element>

This is an array of single characters.

End of change
Start of changeStart of change
PIC X OCCURS n TO m TIMES
DEPENDING ON
t
PIC A OCCURS n TO m TIMES
DEPENDING ON
t
PIC G DISPLAY-1 OCCURS n TO m TIMES
DEPENDING ON
t
PIC N OCCURS n TO m TIMES
DEPENDING ON
t
End of changeEnd of change
Start of change

When CHAR-OCCURS=STRING:

<xsd:element name="field-name" >
      <xsd:simpleType>
            <xsd:restriction base="s:string">
                  <xsd:maxLength value="m">
                  <xsd:minLength value="n">
            </xsd:restriction>
      </xsd:simpleType>
</xsd:element>
End of change
Start of changeStart of changePIC N(n) USAGE NATIONAL

When CHAR-USAGE=NATIONAL: PIC N(n)

End of changeEnd of change
Start of change
<xsd:simpleType>
  <xsd:restriction base="xsd:string">
    <xsd:maxlength value="n"/>
    <xsd:whiteSpace value="preserve"/>
  </xsd:restriction>
</xsd:simpleType>

At run time, CICS populates the application data structure field with UTF-16 data.

End of change