The Copybook Schema resource converts a COBOL Copybook into an XSD that is used to parse COBOL data into an XML document and conversely render XML as COBOL data. The following COBOL Copybook is a simple example of a data schema for a purchase order.
03 DOCUMENT-DATE-TIME PIC X(20) VALUE IS SPACES.
03 QUANTITY PIC 9(4) USAGE IS COMP-3.
04 UNIT-PRICE-CONTROL PIC X.
05 CURRENCY PIC X(10) VALUE IS SPACES.
<xs:complexType name="_ROOT_TYPE">
<xs:element cobol:byteLength="38" cobol:byteOffset="0"
name="PURCHASE-ORDER" minOccurs="0">
<xs:element cobol:byteLength="21" cobol:byteOffset="0"
name="HEADER" minOccurs="0">
<xs:element cobol:byteLength="1"
cobol:fullName="PURCHASE-ORDER.HEADER.DOCUMENT-
cobol:byteOffset="0" cobol:usage="DISPLAY"
name="DOCUMENT-DEP" minOccurs="0">
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="1"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="20"
cobol:fullName="PURCHASE-ORDER.HEADER.DOCUMENT-
cobol:byteOffset="1" cobol:usage="DISPLAY"
name="DOCUMENT-DATE-TIME" default="SPACES"
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:element cobol:byteLength="17"
cobol:byteOffset="21" name="LINEITEM" minOccurs="0">
<xs:element cobol:byteLength="1"
cobol:fullName="PURCHASE-ORDER.LINEITEM.
cobol:byteOffset="21" cobol:usage="DISPLAY"
name="ORDERITEM-DEP" minOccurs="0">
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="1"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="3"
cobol:fullName="PURCHASE-ORDER.LINEITEM.
cobol:usage="PACKED-DECIMAL" name="QUANTITY"
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="4"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="13"
cobol:byteOffset="25" name="UNIT-PRICE"
<xs:element cobol:byteLength="1"
cobol:fullName="PURCHASE-ORDER.LINEITEM.
UNIT-PRICE.UNIT-PRICE-CONTROL"
name="UNIT-PRICE-CONTROL" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>
<xs:element cobol:byteLength="12"
name="ACTUAL" minOccurs="0">
<xs:element cobol:byteLength="10"
cobol:picture="X(10)" cobol:fullName="PURCHASE-ORDER.LINE
ITEM.UNIT-PRICE.ACTUAL.CURRENCY"
default="SPACES" minOccurs="0">
<xs:maxLength value="10"/>
<xs:element cobol:byteLength="2"
cobol:picture="99" cobol:fullName="PURCHASE-ORDER.LINE
ITEM.UNIT-PRICE.ACTUAL.FILLER"
name="FILLER" minOccurs="0">
<xs:totalDigits value="2"/>
<xs:minInclusive value="0"/>