Support for substitution groups

You can use a substitution group to define a group of XML elements that are interchangeable. The CICS® assistants provide support for substitution groups at mapping level 2.2 and higher.

At mapping level 2.2 and higher, DFHSC2LS and DFHWS2LS support substitution groups using similar mappings to those used for <xsd:choice> elements. The assistant generates an enumeration field and a new container name in the language structure.

The following XML schema fragment includes an array of two subGroupParent elements, each of which can be replaced with replacementOption1 or replacementOption2:
<xsd:element name="subGroupExample" >
   <xsd:complexType>
      <xsd:sequence>
         <xsd:element ref="subGroupParent" maxOccurs="2" minOccurs="2" />
      </xsd:sequence>
   </xsd:complexType>
</xsd:element>

<xsd:element name="subGroupParent" type="xsd:anySimpleType" />
<xsd:element name="replacementOption1" type="xsd:int" substitutionGroup="subGroupParent" />
<xsd:element name="replacementOption2" type="xsd:short" substitutionGroup="subGroupParent" />
Processing this XML fragment with the assistant generates the following COBOL language structures:
   03 subGroupExample.
      06 subGroupParent OCCURS2.
         09 subGroupExample-enum	PIC X DISPLAY.
            88 empty            		VALUE X '00'.
            88 replacementOption1		VALUE X '01'.
            88 replacementOption2		VALUE X '02'.
            88 subGroupParent    		VALUE X '03'.
         09 subGroupExample-cont	PIC X (16).



01 Example-replacementOption1.
   03 replacementOption1    		PIC S9(9) COMP-5 SYNC.

01 Example-replacementOption2.
   03 replacementOption2    		PIC S9999 COMP-5 SYNC.

01 Example-subGroupParent.
   03 subGroupParent-length 		PIC S9999 COMP-5 SYNC.
   03 subGroupParent        		PIC X(255).

For more information about substitution groups, see the W3C XML Schema Part 1: Structures Second Edition specification: https://www.w3.org/TR/xmlschema-1/#Elements_Equivalence_Class