Please enable JavaScript to view this site.

Some z/OS applications use "COPYBOOK" descriptions that contain both relational SQL/DDL style and COBOL style descriptions, for example:

DESCRIPTION DB2SQL ./DB2DDL/DEPT_DB2_COB.ddl   AS DEPT;

 

Referencing this file:

EXEC SQL DECLARE DEPT TABLE

(

    DEPTNO                  CHAR(3)     NOT NULL,

    DEPTNAME                VARCHAR(36),

    MGRNO                   CHAR(6),

    ADMRDEPT                CHAR(3),

    LOCATION                CHAR(16)

) END-EXEC.

**********************************************

COBOL DECLARATION FOR DEPT

**********************************************

      01  DEPT.

        03  DATA-RECORD

          05  DEPTNO        PIC X(3).

          05  DEPT-NAME     PIC X(36).

          05  MGR-NO        PIC X(6).

          05  ADMR-DEPT     PIC X(3).

          05  LOCATION      PIC X(16.)

 

Instead of the usual CREATE TABLE <table_name> syntax, this description file actually contains both a form of DDL and a more typical COBOL File description.

Strange as this might look, the  what is critical to the Engine script is specifying the proper Description type "DB2SQL".

Notes:

1.The example has a VARCHAR column in the DDL matched to a normal PIC X(n) fixed length field in the COBOL. There are some restrictions regarding the use of DB2 VARCHARS.

2.The key points are use the DB2SQL description type and any "mapping" of source to target columns must reference the source DB2 "ddl" column names not the corresponding "COBOL" field names.