About COBOL Copybooks

A COBOL copybook is a file that contains COBOL source code and is used to synchronize that code among various COBOL programs. A copybook may be included in more than one COBOL program, and a program may include more than one copybook. Copybooks often contain the name and data types of variables that associated COBOL programs, such as CICS COMMAREA, use to exchange information. Typically, programs that exchange data in this way are compiled with the same copybook file.

Before you can use Transaction Studio, you must copy the necessary COBOL copybooks from the host to a location you can access from the workstation on which Transaction Studio is installed, such as a network share.

Copybooks for some host programs exist as separate files, for other programs, the data declarations might be mixed in with other data division statements, and some host programs are written in languages other than the COBOL language. In this case, use the Copybook Editor to assemble the copybook fragments, or to manually create the COBOL data structure statements.

To create a project and ultimately build interface objects, Transaction Studio must know which data fields are for input and which are for output. In a COBOL copybook file, the data declarations themselves do not reveal this information. You must know about the program functions to do this. (In the first step of the client operation creation process, you designate data structures as input or output, or both, in a host transaction.)

Limitations

Transaction Studio has some limitations with the COBOL data division entries it can handle. For detailed information, see COBOL Data Division Entries.

In this version, Transaction Studio does not support the euro symbol (€) within copybooks. (This symbol can occur in the VALUE clause, or in the PIC clause.) To work around this, you can replace the euro symbol with the dollar sign ($) in the copybook. The receiving host application should interpret the dollar sign as the currency it expects.

Sample COBOL Copybook

     ***********************************************
     * CUSTOMER RECORD QTXCUS2R
     * KEY FOR RECORDS IN VSAM FILE IS CUSTOMER-NAME
     ***********************************************
     O   05 CUSTOMER-RCD.
     IO    10 CUSTOMER-NAME.
             15 LAST-NAME    PIC X(16).
             15 FIRST-NAME   PIC X(16).
           10 CUSTOMER-HOME-ADDRESS.
             15 STREET       PIC X(30).
             15 CITY         PIC X(20).
             15 STATE        PIC X(2).
             15 ZIP          PIC X(10).
           10 CUSTOMER-PHONE-NUMBER    PIC X(10).
           10 CUSTOMER-CREDIT-LIMIT    PIC S9(6)V99.
           10 CUSTOMER-ACCT-BALANCE    PIC S9(13)V99 COMP-3
                          OCCURS 2 TIMES.
           10 CUSTOMER-INTEREST-RATE        COMP-1
                          OCCURS 2 TIMES.

 

Related Topics
Bullet Import Copybooks
Bullet COBOL Data Division Entries