Dclgen

Dclgen

A declarations generator or DCLGEN (pronounced dekel-jin) is a table schema used by COBOL programs that work against a database, often IBM DB2 on a mainframe.

Contents

Composition

A DCLGEN generally has two sections: The SQL declaration for a DB2 table and the COBOL COPYBOOK definition corresponding to the SQL declaration.

Example

     ******************************************************************        
     * DCLGEN TABLE(STUDENTS)                                         *                     
     *        LIBRARY(DEVL.SAP.STUDENTS(STUDENTS))                    *        
     *        ACTION(REPLACE)                                         *        
     *        LANGUAGE(COBOL)                                         *        
     *        NAMES(SAP-)                                             *        
     *        APOST                                                   *        
     *        COLSUFFIX(YES)                                          *        
     ******************************************************************        
          EXEC SQL DECLARE STUDENTS TABLE                               
          ( ID                             DECIMAL(11, 0) NOT NULL,            
            STUDENT_NUM                    SMALLINT NOT NULL,                  
            ACTIVE                         CHAR(1) NOT NULL,                   
            REG_TIME                       TIMESTAMP NOT NULL,                 
            START_DATE                     DATE NOT NULL,                      
            END_DATE                       DATE NOT NULL                      
           ) END-EXEC.                                                          
     ******************************************************************        
     * COBOL DECLARATION FOR TABLE STUDENTS                           *        
     ******************************************************************        
      01  DCLABNV-GST-STATUS.                                                  
          10 ID                   PIC S9(11)V USAGE COMP-3.                    
          10 STUDENT-NUM          PIC S9(4) USAGE COMP.                        
          10 ACTIVE               PIC X(1).                                    
          10 REG-TIME             PIC X(26).                                   
          10 START-DATE           PIC X(10).                                   
          10 END-DATE             PIC X(10).                                   
     ******************************************************************        
     ******************************************************************               

Usage

DCLGEN libraries are specified as input for the PDL program. This is used to pre-generate Delta virtual macros, and as input for PDL for generating Delta code, and is also used by the DB2 pre-compiler ( normally DSNHPC, but in the case of compiling with Viasoft the compiler is VIASQL.

DCLGENs must be pre-compiled (for use with via Delta Virtual Macros, Delta, or DB2) before the source can be compiled as COBOL (using IGYCRCTL normally, or using VIACOBII for Viasoft SmartTest).

References



Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”