It is common in COBOL application development to create reusable sequences of code by putting them into “COPY” files (COPY books) and achieve re-use by including the same COPY book in multiple source files (via the COBOL COPY statement).
Figure 1 is a example of a typical sequence of code to re-use is data definition that repeats in multiple data structures. In this example, the two data definitions re-use the same COPY book named COMMHDR.
01 departmentUpdateRequest.
COPY COMMHDR.
COPY DEPTBDY.
01 departmentUpdateReply.
COPY COMMHDR.
02 updStatus pic xxx.
Figure 2 and Figure 3 show of the content of the COMMHDR copybook and DEPTBDY copybook.
Prior to IBM® Rational® Developer for System z® Version 7.5, service interfaces generated from data structures that referenced COPY books required that complete XML schemas (XSDs) be generated for each data structure.
<schema ...
targetNamespace="http://www.TST01I.com/schemas/TST01IInterface"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cbl="http://www.TST01I.com/schemas/TST01IInterface">
<complexType name="departmentUpdateRequest">
<sequence>
<element name="commHeader"
type="cbl:departmentupdaterequest_commheader"/>
<element form="qualified" name="member_count">
<simpleType>
...
</simpleType>
</element>
<element name="dept_details"
type="cbl:departmentupdaterequest_dept__details"/>
</sequence>
</complexType>
<complexType name="departmentupdaterequest_commheader">
<sequence>
<element form="qualified" name="commId">
<simpleType>
...
</simpleType>
</element>
<element form="qualified" name="commRevDate">
<simpleType>
...
</simpleType>
</element>
<element form="qualified" name="commDigest">
<simpleType>
...
</simpleType>
</element>
</sequence>
</complexType>
<complexType name="departmentupdaterequest_dept__details">
<sequence>
...
</sequence>
</complexType>
<element name="departmentUpdateRequest" type="cbl:departmentUpdateRequest">
</schema>
<schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://www.TST01O.com/schemas/TST01OInterface"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:cbl="http://www.TST01O.com/schemas/TST01OInterface">
<complexType name="departmentUpdateReply">
<sequence>
<element name="commHeader" type="cbl:departmentupdatereply_commheader"/>
<element form="qualified" name="updStatus">
...
</element>
</sequence>
</complexType>
<complexType name="departmentupdatereply_commheader">
<sequence>
<element form="qualified" name="commId">
...
</element>
<element form="qualified" name="commRevDate">
...
</element>
<element form="qualified" name="commDigest">
...
</element>
</sequence>
</complexType>
<element name=" departmentUpdateReply" type="cbl:departmentUpdateReply">
...
</element>
</schema>
(departmentupdaterequest_commheader. VS. departmentupdatereply_commheader)
and
(xmlns:cbl="http://www.TST01I.com/schemas/TST01IInterface. VS. xmlns:cbl="http://www.TST01O.com/schemas/TST01OInterface) .
Because a single COPY book can be used for multiple services the multiplicity of similarly typed elements may lead to unnecessary duplication of code generated for the clients from such WSDL or XSD files.
This feature allows users to specify common COPY book and common XSD types and elements that can be re-used by multiple interfaces without having to have duplicate schema content.