Rational Developer for System z

XML and COBOL structure compatibility

You can match subordinate elementary COBOL group items to simple type elements of XML complex types.

The following table shows XML COBOL groups and repeating items and sample XML structures that COBOL items can be mapped to:
Table 1. Example of XML Structure and COBOL Mapping
COBOL structure: Sample compatible XML structure:
COBOL Group:
2 SimpleGroup
  3 DEPOSIT-REQUEST1 PIC X. 
<complexType name="groups_simplegroup">
   <sequence>
     <element name="deposit_request1">
       <annotation>
         <appinfo source="http://www.wsadie.com/appinfo">
           <initialValue kind="SPACE"/>
         </appinfo>
       </annotation>
       <simpleType>
         <restriction base="string">
           <maxLength value="1"/>
         </restriction>
       </simpleType>
     </element>
   </sequence>
</complexType>
COBOLNested groups:
2 NestedGroup.
  3 SimpleItem pic 9.
  3 NestingGroup1.
    5 DEPOSIT-REQUEST2 PIC X.
    5 Action-Code2 PIC 999.
<complexType name="groups_nestedgroup">
  <sequence>
    <element name="SimpleItem">
      <simpleType>
        <restriction base="short">
          <minInclusive value="0"/>
          <maxInclusive value="9"/>
        </restriction>
      </simpleType>
    </element>
    <element name="NestingGroup1" 
            type="cbl:groups_nestedgroup_nestinggroup1"/>
  </sequence>
</complexType>
<complexType name="groups_nestedgroup_nestinggroup1">
  <sequence>
    <element name="deposit_request2">
      <annotation>
        <appinfo source="http://www.wsadie.com/appinfo">
          <initialValue kind="SPACE"/>
        </appinfo>
      </annotation>
      <simpleType>
        <restriction base="string">
          <maxLength value="1"/>
        </restriction>
      </simpleType>
    </element>
    <element name="Action_Code2">
      <simpleType>
        <restriction base="short">
          <minInclusive value="0"/>
          <maxInclusive value="999"/>
        </restriction>
      </simpleType>
    </element>
  </sequence>
</complexType>
COBOL OCCURS - fixed length array (elementary item):
2 SimpleArray occurs 7 times   PIC A.
<element maxOccurs="7" minOccurs="7" name="SimpleArray">
  <annotation>
    <appinfo source="http://www.wsadie.com/appinfo">
      <initialValue kind="SPACE"/>
    </appinfo>
  </annotation>
  <simpleType>
    <restriction base="string">
      <maxLength value="1"/>
    </restriction>
  </simpleType>
</element>
COBOL OCCURS - fixed length array (group item):
2 RepeatingGroup occurs 7 times.
  3 DEPOSIT-REQUEST3 PIC X.
<element maxOccurs="7" minOccurs="7" name="RepeatingGroup" 
      type="cbl:Groups_repeatinggroup"/>
<complexType name="Groups_repeatinggroup">
    <sequence>
      <sequence>
        <element name="deposit_request3">
          <annotation>
            <appinfo source="http://www.wsadie.com/appinfo">
              <initialValue kind="SPACE"/>
            </appinfo>
          </annotation>
          <simpleType>
            <restriction base="string">
              <maxLength value="1"/>
            </restriction>
          </simpleType>
        </element>
      </sequence>
    </sequence>
</complexType>
COBOL OCCURS DEPENDING ON - variable length array (elementary item):
2 Odo-Count PIC 9.
2 ODOSimpleArray occurs 0 to 5
      depending on Odo-Count pic 9.
<element maxOccurs="5" minOccurs="0" name="ODOSimpleArray">
  <annotation>
    <appinfo source="http://www.wsadie.com/appinfo">
      <dependingOn>depending-on model reference</dependingOn>
    </appinfo>
  </annotation>
  <simpleType>
    <restriction base="short">
      <minInclusive value="0"/>
      <maxInclusive value="9"/>
    </restriction>
  </simpleType>
</element>
COBOL OCCURS DEPENDING ON - variable length array (group item):
2 RepeatingGroupODO occurs
      0 to 7 times
      depending on Odo-Count1.
  3 DEPOSIT-REQUEST4 PIC X.
  3 Action-Code PIC 999.
<element maxOccurs="7" minOccurs="0" name="RepeatingGroupODO" 
      type="cbl:Groups_repeatinggroupodo">
  <annotation>
    <appinfo source="http://www.wsadie.com/appinfo">
       <dependingOn>depending-on model reference</dependingOn>
    </appinfo>
  </annotation>
</element>

<complexType name="Groups_repeatinggroupodo">
  <sequence>
    <sequence>
      <element name="deposit_request4">
        <annotation>
          <appinfo source="http://www.wsadie.com/appinfo">
            <initialValue kind="SPACE"/>
          </appinfo>
        </annotation>
        <simpleType>
          <restriction base="string">
            <maxLength value="1"/>
          </restriction>
        </simpleType>
      </element>
      <element name="Action_Code">
        <simpleType>
          <restriction base="short">
            <minInclusive value="0"/>
            <maxInclusive value="999"/>
          </restriction>
        </simpleType>
      </element>
    </sequence>
  </sequence>
</complexType>

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)