Compatibility: Enterprise COBOL groups and repeating items

This topic describes the compatibility of groups and repeating items in Enterprise COBOL for z/OS® with XML structures.

Compatibility is supported for mapping elementary COBOL groups and data items to simple XML structures. Selecting or mapping OCCURS DEPENDING ON (ODO) objects is not required in bottom-up or meet-in-middle scenarios when using Compiled XML Conversion. Table 1 shows examples of compatible items:

Table 1. Examples of compatible items
Enterprise COBOL group or repeating item: 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>
COBOL Nested 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.
The following code is generated when an ODO object is selected as the interface.
<dependingOn>depending-on model reference</dependingOn>
<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.
The following code is generated when an ODO object is selected as the interface.
<dependingOn>depending-on model reference</dependingOn>
<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>