About COBOL Copybooks

A COBOL copybook is a file that contains COBOL data declarations, created when a COBOL program is compiled on the host. A copybook may be included in more than one COBOL program, and a program may include more than one copybook. The names and data types of variables that associated COBOL programs use to exchange information are declared by the copybook in an area of memory called the Program I/O area. Typically, programs that exchange data in this way are compiled with the same copybook file.

Before you can use Task Builder, you'll need to copy the necessary COBOL copybooks from the host to a location you can access from the workstation on which Task Builder is installed, such as a network share.

Copybooks for some programs exist in a separate file; for other programs, the copybook data declarations might be buried within other COBOL statements. In this case, you'll need to extract the copybook into its own file.

To create a task file, Task Builder 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 will need to know about the program functions to do this. (In the first step of the task-file creation process, you designate copybooks as input or output, or both, in a host program definition.)


Task Builder has some limitations with the COBOL Data Division entries it can handle. For detailed information, refer to the topic COBOL Data Division Entries Supported by Task Builder.

In this version, Task builder 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.

Copybook Example

The following example shows a sample COBOL copybook:

     O   05 CUSTOMER-RCD.
     IO    10 CUSTOMER-NAME.
             15 LAST-NAME    PIC X(16).
             15 FIRST-NAME   PIC X(16).
             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 Synapta Services Builder for IMS
Bullet Creating Task Files
Bullet COBOL Data Division Entries Supported by Task Builder
Bullet Creating a Host Program Definition
Bullet Properties of Input and Output Fields