C and C++ to XML schema mapping

The DFHLS2SC and DFHLS2WS utility programs support mappings between C and C++ data types and XML schema definitions.

C and C++ names are converted to XML names according to the following rules:
  1. Characters that are not valid in XML element names are replaced with 'X'.

    For example, monthly-total becomes monthlyXtotal.

  2. Duplicate names are made unique by the addition of one or more numeric digits.

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

DFHLS2SC and DFHLS2WS map C and C++ data types to schema elements according to the following table. C and C++ types that are not shown in the table are not supported by DFHLS2SC or DFHLS2WS. The _Packed qualifier is supported for structures. These restrictions apply:
  • Header files must contain a top-level struct instance.
  • You cannot declare a structure type that contains itself as a member.
  • The following C and C++ data types are not supported:
    • decimal
    • long double
    • wchar_t (C++ only)
  • The following characters are ignored if they are present in the header file.
    Storage class specifiers:
    • auto
    • register
    • static
    • extern
    • mutable
    Qualifiers
    • const
    • volatile
    • _Export (C++ only)
    Function specifiers
    • inline (C++ only)
    • virtual (C++ only)
    Initial values
  • The header file must not contain these items:
    • Unions
    • Class declarations
    • Enumeration data types
    • Pointer type variables
    • Template declarations
    • Predefined macros; that is, macros with names that start and end with two underscore characters (__)
    • The line continuation sequence (a \ symbol that is immediately followed by a newline character)
    • Prototype function declarators
    • Preprocessor directives
    • Bit fields
    • The __cdecl (or _cdecl) keyword (C++ only)
  • The application programmer must use a 32-bit compiler to ensure that an int maps to 4 bytes.
  • The following C++ reserved keywords are not supported:
    • explicit
    • using
    • namespace
    • typename
    • typeid
  • 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, <xsd:whiteSpace value="collapse"/> is generated for strings.
C and C++ data type Schema simpleType
char[z]
<xsd:simpleType>
  <xsd:restriction base="xsd:string">
    <xsd:length value="z"/>
  </xsd:restriction>
</xsd:simpletype>
char16_t[n]

At mapping level 4.0 and higher:

<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.

char[8]

Supported at mapping level 3.0 and higher when DATETIME=PACKED15

<xsd:simpleType>
  <xsd:restriction base="xsd:dateTime"
  </xsd:restriction>
</xsd:simpleType>
The format of the time stamp is CICS ABSTIME.
char
<xsd:simpleType>
  <xsd:restriction base="xsd:byte">
  </xsd:restriction>
</xsd:simpletype>
unsigned char
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedByte">
  </xsd:restriction>
</xsd:simpletype>
short
<xsd:simpleType>
  <xsd:restriction base="xsd:short">
  </xsd:restriction>
</xsd:simpletype>
unsigned short
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedShort">
  </xsd:restriction>
</xsd:simpletype>
int
long
<xsd:simpleType>
  <xsd:restriction base="xsd:int">
  </xsd:restriction>
</xsd:simpletype>
unsigned int
unsigned long
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedInt">
  </xsd:restriction>
</xsd:simpletype>
long long
<xsd:simpleType>
  <xsd:restriction base="xsd:long">
  </xsd:restriction>
</xsd:simpletype>
unsigned long long
<xsd:simpleType>
  <xsd:restriction base="xsd:unsignedLong">
  </xsd:restriction>
</xsd:simpletype>
bool

(C++ only)

<xsd:simpleType>
  <xsd:restriction base="xsd:boolean">
  </xsd:restriction>
</xsd:simpletype>
float

Supported at mapping level 1.2 and higher

<xsd:simpleType>
  <xsd:restriction base="xsd:float">
  </xsd:restriction>
</xsd:simpletype>
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 float data types with fixed precision alternatives.
double

Supported at mapping level 1.2 and higher

<xsd:simpleType>
  <xsd:restriction base="xsd:double">
  </xsd:restriction>
</xsd:simpletype>
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 double data types with fixed precision alternatives.