Schema File Structure

Analyzing the structure of the original data set is most important when converting mainframe data sets to OpenFrame data sets. For the analysis, you need to create data set conversion schema file based on COBOL Copybooks or PL/I Include files.

This section describes the structure of schema file (v7.1) and other items required for data set conversion.

1. Schema File Structure (v7.1)

A schema file can be created by using the cobgensch, pligensch and sqlgensch tool.

There are two types of schemas: general schema and dynamic schema.

  • General Schema

    * Schema Version 7.1
     Label, Level, Field Name, Conversion Type, Sign Type, Length, Occurs, ODO Field
    
     * Condition
     Label, "Value", ( Label List )
  • Dynamic Schema

    Includes Redefine Group ID and Redefine Element ID in addition to the items in a general schema. The following is the structure of a schema for dynamic conversion.

    * Schema Version 7.1 - Dynamic conversion
     Label, Level, Field Name, Conversion type, Sign type, Length, Occurs, ODO Field, Redefine Group ID, Redefine Element ID
    
     * Condition
     Label, "Value", ( Label List )
  1. For more information about the cobgensch, pligensch, sqlgensch tools, refer to OpenFrame Tool Reference Guide.

  2. The schema file version created by using the latest OpenFrame/Base tool, sqlgensch, is not v7.1 and therefore cannot be used for migration.

The following describes each item of the schema structure.

Item Description

Label

Unique field label.

Level

Level of the field.

Field Name

Name of the field.

Conversion Type

Data type of the field. The following are the available data types.

  • EBC_ASC: Single-byte Character

  • COPY: Binary

  • PACKED: Packed Decimal

  • U_PACKED: Unsigned Packed Decimal

  • ZONED: Zoned Decimal

  • U_ZONED: Unsigned Zoned Decimal

  • GRAPHIC: Double-byte Character

Sign Type

Sign type defined in the COBOL SIGN IS clause for numeric data. The default is TRAILING.

The following are the available sign types:

  • TRAILING: 2-bit sign after the data.

  • LEADING: 2-bit sign before the data.

  • TRAILING_SEPARATE: Separate 1-byte sign after the data.

  • LEADING_SEPARATE: Separate 1-bye sign before the data.

Length

Field length.

Occurs

Occurrences of Occurs

ODO Field

Field name that Occurs Depending On points to.

Redefine Group ID

Group ID of REDEFINES clause.

Redefine Element ID

ID of the element in the Redefine Group ID.

COND Section

The condition section in the schema file is generated by the $$COND statement in the Copybook. The $$COND statement structure is as follows:

$$COND : FIELD_01 : VALUE_01 (, VALUE02 … ) [: FIELD_02 : VALUE_03 (, VALUE04 ) … ] : REDEFINE_NAME [...]

When you use multiple 'FIELD_# : VALUE_#' conditions, each condition can be separated with a colon (:). In each field, you can compare multiple condition values (VALUE). If these conditions are satisfied, REDEFINES is executed.

For more information about the REDEFINES clause, refer to Data Sets with REDEFINES Statements.

Condition Section

The following describes the structure of the Condition statement, which corresponds to $$COND statement in the schema file.

L#1, "VALUE_01" "VALUE02" …  [, L#2, "VALUE_03" "VALUE04 … ], ( Label List )
Item Description

Label(L#)

Label number of the field defined in REDEFINES statement.

Condition Value(VALUE_#)

Values to compare with the field value of the label redefined in the REDEFINES statement. If a match is found, layout is created in the order of the label list. A field value of a label can be compared with multiple condition values connected with an OR. Condition statement of multiple labels can be compared with condition values separated by a comma (,).

Label List

Label order list to use when the label field value meet the condition values.

1.1. ODO(Occurs Depending On) Items

The ODO clause is an option that can be used to determine the OCCURS count by using other field values. The following Copybook shows an example of using the ODO option. The OCCURS count specified in the ODO clause represents the Min/Max value (if only one is specified, it is the Max value) and does not represent the actual number of repetitions. If ODO clause is not specified, the OCCURS count is set to 1 by default.

Currently, ODO can only be set on fields that are defined in the layout. The fields defined outside the layout cannot be set.

The following are sample COBOL Copybook with an ODO clause and schema file.

<COBOL Copybook>

01 ROOT.
   03 AAA PIC X(1).
   03 ODO OCCURS 10 DEPENDING ON AAA.
     05 BBB PIC S9(2).
   03 CCC PIC X(1) OCCURS 5.

<Schema File>

* Schema Version 7.1
L1, 01, ROOT, NULL, NULL, 0, 1:1,
L2, 03, AAA, EBC_ASC, NULL, 1, 1:1,
L3, 03, ODO, NULL, NULL, 0, 1:10, AAA
L4, 05, BBB, ZONED, TRAILING, 2, 1:1,
L5, 03, CCC, EBC_ASC, NULL, 1, 1:5,

* Condition
L0, "\0", ( L1 L2 L3 L4 L5 )

In this example, the condition statement that starts with L0 shows the default layout order list. For more information, refer to the following chapter.

1.2. REDEFINES

You must specify conditions for a data set with a layout that includes a REDEFINES statement.

For more information about REDEFINES, refer to Data Sets with REDEFINES Statements.

The following are sample COBOL Copybook with a REDEFINES statement and schema file.

<COBOL Copybook>

01 ROOT.
   03 AAA PIC X(2).
   03 BBB PIC X(3).
   03 BBB-1 PIC S9(3) REDEFINES BBB.
   03 CCC PIC X(3).
   03 CCC-1 PIC 9(5) COMP-3 REDEFINES CCC.

$$COND : AAA : "AB" : BBB-1 ( multiple redefines can be defined here!)
$$COND : CCC : T"PACKED" : CCC-1

<Schema File>

* Schema Version 7.1
L1, 01, ROOT, NULL, NULL, 0, 1:1,
L2, 03, AAA, EBC_ASC, NULL, 2, 1:1,
L3, 03, BBB, EBC_ASC, NULL, 3, 1:1,
L4, 03, BBB-1, ZONED, TRAILING, 3, 1:1,  # REDEFINES BBB
L5, 03, CCC, EBC_ASC, NULL, 3, 1:1,
L6, 03, CCC-1, U_PACKED, NULL, 3, 1:1,  # REDEFINES CCC

* Condition
L2, "AB", ( L1 L2 L4 L5 )
L5, T"PACKED", ( L1 L2 L3 L6 )
L0, "\0", ( L1 L2 L3 L5 )

In comparing the previous Copybook with the first condition line in the schema file, REDEFINES executes if L2 (Label2) matches the field name AAA and the field value is 'AB'. This creates a layout in the order of L1, L2, L4, and L5. According to the second condition, REDEFINES executes if L5 (Label5) matches the field name CCC and the field value is 'T"PACKED"'. This creates a layout in the order of L1, L2, L3, and L6. The last label L0 specifies the default layout order.

1.3. Condition Value Type

The condition values in the Condition section of the schema file that corresponds to the $$COND statement in the Copybook can be defined with multiple types. This allows you to convert the field type as needed by specifying the field type before the opening quotation mark (") that enclose the condition value.

The following are available field types.

Type Description

! (exclamation mark)

Checks NOT EQUALITY.

'(empty)'

Returns the default type of the field.

'A'

Uses the ASCII character of the value.

'E'

Converts to EBCDIC character.

'P' or 'UP'

Converts to Packed Decimal or Unsigned Packed Decimal type.

'Z' or 'UZ'

Converts to Zoned Decimal or Unsigned Zoned Decimal type.

'G'

Converts to GRAPHIC (2Byte) character.

'H'

Coverts the value to a Hexadecimal value. (Example: H"123" -> 0x7B)

'X'

Converts the 2 byte value to a 1 byte Hex value. (Example: X"12AB" -> 0x12 0xAB)

'T'

Checks the field type. The following types are supported.

  • ZONED (zoned decimal)

  • PACKED (packed decimal)

  • GRAPHIC (2 byte characters)

  • CHAR (1 byte characters)

(Example: T"ZONED" → Checks whether the field is Zoned Decimal.)

For more information about condition value (VALUE) types, refer to Data Sets with REDEFINES Statements.