Using templates with non-Db2 data

Some FM/Db2 functions interface with non-Db2 data:
  • You can retrieve non-Db2 data with these FM/Db2 functions:
    • Import (option 3.6) — for retrieving non-Db2 data from a VSAM or QSAM data set.
    • The Db2® LOAD utility in Utilities (option 3.9) — for retrieving data from a sequential data set.
  • You can write data to non-Db2 files with these FM/Db2 functions:
    • Export (option 3.7) — for writing data to a VSAM data set, a sequential data set, or a member of a partitioned data set.
    • The Db2® UNLOAD utility in Utilities (option 3.9) — for unloading data to a sequential data set.

Because this is non-Db2 data, FM/Db2 is not able to create a template from the Db2® catalog table. Instead, you have to provide a source for the template. The source is either a (non-Db2) template or a copybook. This describes the records and fields in the data set or member. If you specify a copybook, FM/Db2 compiles it into a template. You can save it and reuse it with any application data set that has the same record structure.

A copybook is a data set containing COBOL, HLASM, or PL/I source statements that describe the record structure of an application data set:
COBOL data description entries
Each level-01 group item in the copybook describes a record type in the application data set; elementary items in the group describe fields in the record type.
For example, the following entries describe the record structure of an application data set that contains two record types, ORDER and ITEM:
01 ORDERS.
   02 ORDER-ID        PIC X(5).
   02 CUSTOMER-ID     PIC X(5).
   02 ORDER-DATE.
      03 ORDER-YEAR   PIC X(4).
      03 ORDER-MONTH  PIC X(2).
      03 ORDER-DAY    PIC X(2).
01 ITEM.
   02 PRODUCT-ID      PIC X(9).
   02 QUANTITY        PIC 9(4) BINARY.
   02 UNIT-COST       PIC 9(8) BINARY.

ORDER records contain five fields: ORDER-ID, CUSTOMER-ID, ORDER-YEAR, ORDER-MONTH and ORDER-DAY. ITEM records contain three fields: PRODUCT-ID, QUANTITY and UNIT-COST.

HLASM DSECT definitions
HLASM copybooks are similar to COBOL copybooks, in that the major structures (DSECT names) describe record types and elementary names describe fields:
ORDER      DESCT
ORDERID    DS  CL9
CUSTOMERID DS  CL5
ORDERDATE  DS  0CL8
ORDERYEAR  DS  CL4
ORDERMONTH DS  CL2
ORDERDAY   DS  CL2
ITEM       DESCT
PRODUCTID  DS  CL9
QUANTITY   DS  H
UNITCOST   DS  F
PL/I DECLARE statements
Similar to COBOL copybooks, major structures (level-1 names) describe record types, and elementary names describe fields:
DECLARE 1 ORDER,
          2 ORDER_ID       CHAR(9),
          2 CUSTOMER_ID    CHAR(5),
          2 ORDER_DATE,
            3 ORDER_YEAR   CHAR(4),
            3 ORDER_MONTH  CHAR(2),
            3 ORDER_DAY    CHAR(2);
DECLARE 1 ITEM,
          2 PRODUCT_ID     CHAR(9),
          2 QUANTITY       BIN(15),
          2 UNIT_COST      BIN(31);

A copybook can contain the entire source of a COBOL, HLASM, or PL/I program, or only COBOL data description entries, HLASM DSECT definitions, or PL/I DECLARE statements. FM/Db2 ignores everything in the copybook except for COBOL data description entries, HLASM DSECT definitions, or PL/I DECLARE statements.

FM/Db2 supports copybooks stored in any of the following:
  • PDS
  • PDSE
  • CA-Panvalet library
  • Library accessed using the Library Management System Exit
Note:
  1. Library members may not be packed by ISPF.
  2. For details about enabling File Manager to use a CA-Panvalet library, or a library accessed using the Library Management System Exit, see the File Manager Customization Guide.

Related tasks