How to generate Cobol COPYBOOKs for a Datacom/DB Table to see all of the fields and their PICTURE clauses.
There are 2 ways to do this:
1 - One is to sign on to a CICS region and use transaction DDOL.
In DBMAINT mode, type the command "D TBL tablename STA PROD", hit enter, on the first line of that display, in the line commands, type DCB for “display copybook” on the TABLE row and hit PF4, and you will get a display like this:
========================== T O P ==================
02 tablename
03 GROUP-CODE PICTURE X(2).
03 ANALYSIS-CODE PICTURE X(2).
03 SHORT-DESC PICTURE X(15).
03 LONG-DESC PICTURE X(100).
Note: DCB is a margin command. For more other commands use the MARGIN command to display a list of the margin commands.
2 - Second is by using DDUTILTY or DDICF Batch programs:
//DDUTILTY EXEC PGM=DDUTILTY,REGION=4M
//SYSPRINT DD SYSOUT=* PRINT OUTPUT
//SYSPUNCH DD SYSOUT=* PRINT OUTPUT
//SNAPER DD SYSOUT=A CA-DATACOM/DB DUMPS
//SYSDUMP DD SYSOUT=A SYSTEM DUMPS
//SYSIN DD *
-USR DATACOM-INSTALL,NEWUSER
-DEF PATH,STANDARD
-END
-UTL LANGUAGE,COBOL
-RPT START,TABLE,PAYROLL(PROD),STANDARD
-UTL COPY,ELEMENT(ALL),PAY001
-END
/*
If you don't know the table’s Datadictionary name you can get that from a CXX report. In the example above I am pulling all elements in the table. If you have overlapping elements you may have to be more specific on what you want. The reason I started with elements is that most programs work on elements and not rows.
Output looks like this:
-DEF PATH,STANDARD;
-END;
-RPT START,TABLE,PAYROLL(PROD),STANDARD ;
-UTL COPY,ELEMENT(ALL),PAY001 ;
-END ;
./ ADD NAME=PAY001
02 PAY-IDENTIFICATION. <=== This is the first element (partial record)
03 PY-NUMBER PICTURE 9(5).
03 PY-ACTIVITY-CODE PICTURE X(1).
03 PY-ACTIVITY-STATUS PICTURE X(1).
02 PAY-FIGURES. <=== This is the second element (partial record)
03 FG-CURRENT-RATE PICTURE 9(6)V9(2).
03 FG-YTD-WAGE PICTURE 9(6)V9(2).
03 FG-YTD-COMMISSION PICTURE 9(6)V9(2).
03 FG-YTD-TAX PICTURE 9(6)V9(2).
02 PAY-RECORD. <=== This is the whole record (If you look at the CXX report just look at the elements that start at offset 0 and cover the whole row).
03 RC-NUMBER PICTURE 9(5).
03 RC-ACTIVITY-CODE PICTURE X(1).
03 RC-ACTIVITY-STATUS PICTURE X(1).
03 RC-CURRENT-RATE PICTURE 9(6)V9(2).
03 RC-YTD-WAGE PICTURE 9(6)V9(2).
03 RC-YTD-COMMISSION PICTURE 9(6)V9(2).
03 RC-YTD-TAX PICTURE 9(6)V9(2).
===> Pick the elements used by your program.
For just a layout of the table/row use the control cards below:
-USR DATACOM-INSTALL,NEWUSER
-UTL COPY,TABLE,PAYROLL(PROD),PAY001
-END
Output looks like this:
./ ADD NAME=PAY001
02 PAYROLL.
03 NUMBER PICTURE 9(5).
03 ACTIVITY-CODE PICTURE X(1).
03 ACTIVITY-STATUS PICTURE X(1).
03 CURRENT-RATE PICTURE 9(6)V9(2).
03 YTD-WAGES PICTURE 9(6)V9(2).
03 YTD-COMMISSION PICTURE 9(6)V9(2).
03 YTD-TAX PICTURE 9(6)V9(2).
For more information see Datacom DataDictionary Online Reference Guide Chapter "Margin Commands"