The Copybook Schema shared configuration resource describes the schema to use when parsing or rendering COBOL data. This resource allows you to load a COBOL Copybook file by using the Import Copybook Schema button to choose a file containing the schema. These files typically have a
.cpy,
.cob, or
.cbl extension.
|
|
|
|
|
|
|
|
Specifies whether the data is in COBOL fixed or free format. When checked, the data is expected to be in COBOL fixed format where columns 0-6 are reserved for line numbers. When unchecked, the data can be in COBOL free format where the COBOL code can be within columns 0-6.
|
|
|
|
The Import Copybook Schema button brings up a dialog that allows you to choose the file containing the COBOL Copybook schema you wish to import. Once the file is chosen, the COBOL schema appears in the Copybook tab and the XSD schema appears in the XML Schema tab.
This button tests the COBOL Copybook schema and returns the results. When an error is encountered, the line number and column number of the error are displayed.
The COBOL REDEFINES clause allows different data description entries to describe the same storage area, similar to a union in most programming languages. The data description entries for REDEFINES are converted to a choice element in the XSD.
After you import the Copybook schema, you must configure the data description entries for the REDEFINES group. The configuration helps determine the unique data description entry for the group.
If a REDEFINES group is not configured at all (that is, neither a default data description entry nor a control field is assigned), at runtime, the first data description entry from the REDEFINES group is used to map data content of the redefined storage area.
For example, the following Copybook has a control field named UNIT-PRICE-CONTROL that determines whether the next field is ACTUAL or CONVERTED.
03 DOCUMENT-DATE-TIME PIC X(20) VALUE IS SPACES.
04 UNIT-PRICE-CONTROL PIC X.
05 CURRENCY PIC X(10) VALUE IS SPACES.
04 CONVERTED REDEFINES ACTUAL.
05 CONVERSION-FACTOR PIC 99.
The Configure REDEFINES button brings up a dialog that allows you to specify how the contents of the control field determine which data element occurs. To use this dialog, follow this procedure:
5.
|
Select each row in the Control Field Value column of the table below the schema tree. Enter the value in the control field that signifies the data element. For example, if the UNIT-PRICE-CONTROL contains the value "actual", then ACTUAL is the data element. If the field contains "converted", then CONVERTED is the data element. Enter the correct value for each data element.
|
|
−
|
For text control fields, you can enter values that have whitespaces in them. During execution, these values will be processed based on the Parse Activity Trim Whitespaces from String Values. If checked, whitespaces will be trimmed from strings in the data as well as control field values (the spaces in the control field values will not be significant). When Trim Whitespaces from String Values is unchecked, then the unchanged values from data and unchanged control field values will be used for comparison (the spaces in the control field values will be significant). For additional details on Trim Whitespaces, see Parse Copybook Data.
|
|
<xs:element cobol:byteLength="12" cobol:isDefault="true"
cobol:controlFieldValue="actual" cobol:byteOffset="27"
cobol:controlField="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.UNIT-
PRICE-CONTROL"
name="ACTUAL" minOccurs="0">
<xs:element cobol:byteLength="10" cobol:picture="X(10)"
cobol:fullName="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.
cobol:byteOffset="27" cobol:usage="DISPLAY"
name="CURRENCY" default="SPACES" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
<xs:element cobol:byteLength="2" cobol:picture="99"
cobol:fullName="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.
cobol:byteOffset="37" cobol:usage="DISPLAY"
name="FILLER" minOccurs="0">
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="2"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="12"
cobol:controlFieldValue="converted" cobol:byteOffset="27"
cobol:controlField="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.UNIT-
name="CONVERTED" minOccurs="0">
<xs:element cobol:byteLength="10" cobol:picture="X(10)"
cobol:fullName="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.
cobol:byteOffset="27" cobol:usage="DISPLAY"
name="CURRENCY" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
<xs:element cobol:byteLength="2" cobol:picture="99"
cobol:fullName="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.
CONVERTED.CONVERSION-FACTOR"
cobol:byteOffset="37" cobol:usage="DISPLAY"
name="CONVERSION-FACTOR" minOccurs="0">
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="2"/>
<xs:minInclusive value="0"/>
The COBOL OCCURS ... DEPENDING ON clause defines a repeating data element whose number of occurrences depends upon a numeric element. This type of element is automatically converted to a repeating element in the XSD.
For example, the following Copybook contains an element named ORDERITEM that occurs between 0 and 10 times. The number of times the element occurs is determined by the ORDERITEM-DEP field.
03 DOCUMENT-DATE-TIME PIC X(20) VALUE IS SPACES.
03 ORDERITEM OCCURS 0 TO 10 TIMES DEPENDING ON ORDERITEM-DEP.
04 ITEM-TYPE PIC X(10) VALUE IS SPACES.
04 DESCR PIC X(40) VALUE IS SPACES.
04 UNIT-PRICE-CONTROL PIC X.
<xs:element cobol:byteLength="1" cobol:picture="9"
cobol:fullName="PURCHASE-ORDER.LINEITEM.ORDERITEM-DEP"
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="54" cobol:occursMin="0"
cobol:occursMax="10" cobol:byteOffset="22"
cobol:occursDepending="PURCHASE-ORDER.LINEITEM.ORDERITEM-
name="ORDERITEM" minOccurs="0" maxOccurs="10">
<xs:element cobol:byteLength="10"
cobol:fullName="PURCHASE-ORDER.LINEITEM.ORDERITEM.
cobol:byteOffset="22" cobol:usage="DISPLAY"
name="ITEM-TYPE" default="SPACES" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
<xs:element cobol:byteLength="40"
cobol:fullName="PURCHASE-ORDER.LINEITEM.ORDERITEM.
cobol:byteOffset="32" cobol:usage="DISPLAY"
name="DESCR" default="SPACES" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="40"/>
<xs:element cobol:byteLength="4" cobol:picture="9999"
cobol:fullName="PURCHASE-ORDER.LINEITEM.ORDERITEM.
cobol:byteOffset="72" cobol:usage="DISPLAY"
name="SERIAL-NUM" minOccurs="0">
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="4"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="4" cobol:picture="9(4)"
cobol:fullName="PURCHASE-ORDER.LINEITEM.QUANTITY"
cobol:byteOffset="-1" cobol:usage="DISPLAY" name="QUANTITY"
<xs:restriction base="xs:unsignedShort">
<xs:totalDigits value="4"/>
<xs:minInclusive value="0"/>
<xs:element cobol:byteLength="1" cobol:byteOffset="-1"
name="UNIT-PRICE" minOccurs="0">
<xs:element cobol:byteLength="1" cobol:picture="X"
cobol:fullName="PURCHASE-ORDER.LINEITEM.UNIT-PRICE.
cobol:byteOffset="-1" cobol:usage="DISPLAY"
name="UNIT-PRICE-CONTROL" minOccurs="0">
<xs:restriction base="xs:string">
<xs:maxLength value="1"/>