Template and copybook concepts

A copybook is a PDS member containing either COBOL data description entries, PL/I DECLARE statements, or HLASM data description entries:
COBOL copybook
Each level-01 group item in the copybook describes a segment layout; elementary items in the group describe fields in the layout. For example, the following copybook describes three layouts (SHIRE, SHIRE-TOWN and SHIRE-CITY) for a fixed-length segment type:
   01  SHIRE.
       05 SHIRE-KEY.
        10 SHIRE-NAME           PIC X(20).
       05 SHIRE-TYPE            PIC X(1).
            88 SHIRETYPE-SHIRE  VALUE '0'.
            88 SHIRETYPE-TOWN   VALUE '1'.
            88 SHIRETYPE-CITY   VALUE '2'.
       05 SHIRE-CODE1           PIC 9(3).
       05 SHIRE-CODE2           PIC 9(5).
       05 SHIRE-ROAD            PIC S9(15) COMP-3.
       05 SHIRE-RIVER           PIC S9(15) COMP-3.
       05 SHIRE-BRIDGE          PIC S9(15) COMP-3.
   01  SHIRE-TOWN.
       05 SHIRE-KEY.
        10 SHIRE-NAME           PIC X(20).
       05 SHIRE-TYPE            PIC X(1).
            88 SHIRETYPE-SHIRE  VALUE '0'.
            88 SHIRETYPE-TOWN   VALUE '1'.
            88 SHIRETYPE-CITY   VALUE '2'.
              05 SHIRE-CODE1           PIC 9(3).
       05 SHIRE-CODE2           PIC 9(5).
       05 SHIRE-YEAR            PIC 9(4) COMP.
       05 SHIRE-BRICK           PIC S9(15) COMP-3.
       05 SHIRE-WOODEN          PIC S9(15) COMP-3.
       05 SHIRE-SCHOOL          PIC S9(7) COMP-3.
       05 SHIRE-GOLF            PIC S9(4) COMP.
   01  SHIRE-CITY.
       05 SHIRE-KEY.
        10 SHIRE-NAME           PIC X(20).
       05 SHIRE-TYPE            PIC X(1).
            88 SHIRETYPE-SHIRE  VALUE '0'.
            88 SHIRETYPE-TOWN   VALUE '1'.
            88 SHIRETYPE-CITY   VALUE '2'.
       05 SHIRE-CODE1           PIC 9(3).
       05 SHIRE-CODE2           PIC 9(5).
       05 SHIRE-MAJOR           PIC S9(4) COMP.
       05 SHIRE-MAIN-ATTRACTION PIC X(20).
       05 SHIRE-MINOR           PIC S9(4) COMP.
PL/I copybook
Similar to COBOL copybooks, each major structure (level-1 name) describes a segment layout, and elementary names describe fields:
1 SHIRE,
  3 SHIRE_KEY,
    5 SHIRE_NAME           CHAR(20),
  3 SHIRE_TYPE             CHAR(1),
                    /* '0' -SHIRE    */
  3 SHIRE_CODE1            PIC'(3)9',
  3 SHIRE_CODE2            PIC'(5)9',
  3 SHIRE_ROAD             FIXED(15),
  3 SHIRE_RIVER            FIXED(15),
  3 SHIRE_BRIDGE           FIXED(15);
1 SHIRE_TOWN,
  3 SHIRE_KEY,
    5 SHIRE_NAME           CHAR(20),
  3 SHIRE_TYPE             CHAR(1),
                    /* '1' -TOWN     */
  3 SHIRE_CODE1            PIC'(3)9',
  3 SHIRE_CODE2            PIC'(5)9',
  3 SHIRE_YEAR             FIXED BIN(15),
  3 SHIRE_BRICK            FIXED(15),
  3 SHIRE_WOODEN           FIXED(15),
  3 SHIRE_SCHOOL           FIXED(9),
  3 SHIRE_GOLF             FIXED BIN(15);
1 SHIRE_CITY,
  3 SHIRE_KEY,
    5 SHIRE_NAME           CHAR(20),
  3 SHIRE_TYPE             CHAR(1),
                    /* '2' -CITY     */
  3 SHIRE_CODE1            PIC'(3)9',
  3 SHIRE_CODE2            PIC'(5)9',
  3 SHIRE_MAJOR            FIXED BIN(15),
  3 SHIRE_MAIN_ATTRACTION  CHAR(20),
  3 SHIRE_MINOR            FIXED BIN(15);
HLASM copybook
HLASM copybooks are similar to COBOL copybooks, in that the major structures (DSECT names) describe record types and elementary names describe fields:
SHIRE        DSECT
SHIRE_KEY    DS  0CL20
SHIRE_NAME   DS  CL20
SHIRE_TYPE   DS  CL1
SHIRE_CODE1  DS  CL3
SHIRE_CODE2  DS  CL5
SHIRE_ROAD   DS  H
SHIRE_RIVER  DS  H
SHIRE_BRIDGE DS  H
*
SHIRE_TOWN   DSECT
SHIRE_KEY    DS  0CL20
SHIRE_NAME   DS  CL20
SHIRE_TYPE   DS  CL1
SHIRE_CODE1  DS  CL3
SHIRE_CODE2  DS  CL5
SHIRE_YEAR   DS  H
SHIRE_BRICK  DS  PL8
SHIRE_WOODEN DS  PL8
SHIRE_SCHOOL DS  PL4
SHIRE_GOLF   DS  H
*
SHIRE_CITY   DSECT
SHIRE_KEY    DS  0CL20
SHIRE_NAME   DS  CL20
SHIRE_TYPE   DS  CL1
SHIRE_CODE1  DS  CL3
SHIRE_CODE2  DS  CL5
SHIRE_MAJOR  DS  H
SHIRE_MAIN_ATTRACTION DS CL10
SHIRE_MINOR  DS  H

For more information, see the section "Using HLASM copybooks with File Manager" in the base File Manager User's Guide and Reference.

Whenever you create or update a template, FM/IMS:

  1. Concatenates the copybooks (that you have matched with segment types) and includes them all in a shell program.
  2. Invokes the selected compiler to check the syntax of the copybooks, and to produce an ADATA file.
    You can use the Compiler Language Selection panel (option 0.4.1) to specify which compiler you want FM/IMS to invoke. You can specify the acceptable return code level for the compilation in these panels:
    • Set COBOL Processing Options panel (option 0.4.2)
    • Set HLASM Processing Options panel (option 0.4.3)
    • Set PL/I Processing Options panel (option 0.4.4)
  3. If the compilation is completed without errors, then FM/IMS processes the information in the ADATA file to create a template.

    If the compilation is completed with a return code of greater than the specified maximum, then FM/IMS displays a pop-up menu, where you can choose to:

    • Browse the compilation listing.
    • Stop the template creation process.
    • Try the compilation again. Before you select this option, first view the compilation listing and correct any errors in the copybooks. While you are viewing the compilation listing, you can use the ISPF split screen facility to edit the copybooks and correct the errors in another ISPF session.
    • Ignore the errors and proceed with creating the template. This option is only available if FM/IMS is able to create the template. Some compilation errors, such as warnings, might have no effect on the creation of the template. If you are unsure, you should view the compilation listing. If the compilation error is too severe, FM/IMS cannot create a template.
    • Try the compiler for the other language (if the COBOL or PLI compiler language has been selected).