Db2 for z/OS and its ecosystem

 View Only

New DCLGEN capabilities in Db2 for z/OS

By Liyan Zhou posted Thu March 09, 2023 07:59 PM


In  both Db2 12 and Db2 13, the Db2 for z/OS declarations generator (DCLGEN) was recently enhanced by new-function APARs that deliver the following improved support of certain data types.

COMP-5 declarations for integer data in COBOL applications

With PH42857 in Db2 12 and in Db2 13 at GA, DCLGEN now supports generation of COMP-5 declarations for the SMALLINT, INTEGER, and BIGINT data types, which enables you to take advantage of the performance improvement available with the TRUNC(OPT) compiler option in Enterprise COBOL Version 5 or later. 

Before this improvement, customers who wanted to take advantage performance benefits of the TRUNC(OPT) compiler option had to manually edit declaration in the DCLGEN declaration, which involved a lot of coding effort, such as by making the following manual edits in the DCLGEN copybooks:

  •         Change COMP to COMP-5 so it is handled as native binary.
  •         Add a digit to the definition, such as by changing PIC S9(4) to PIC S9(5), so that the data fits into the underlying picture clause.

Otherwise, the TRUNC(BIN) option had to be used, which prevented customers from benefiting from the performance improvements available with TRUNC(OPT).

The following example shows a DCLGEN declaration generated after the improvement.

CREATE TABLE TESTDCLGEN(  C1 INT,    C2 SMALLINT,    C3 BIGINT);                         


* COBOL DECLARATION FOR TABLE TESTDCLGEN                                                               * 


   01  DCLTESTDCLGEN.                                                

       10 C1                   PIC S9(9) USAGE COMP-5.               

       10 C2                   PIC S9(4) USAGE COMP-5.               

       10 C3                   PIC S9(18) USAGE COMP-5.              


* INDICATOR VARIABLE STRUCTURE                                                                                     * 


   01  ITESTDCLGEN.                                                  

       10 INDSTRUC           PIC S9(4) USAGE COMP-5 OCCURS 3 TIMES.  




DECFLOAT datatype support for PL/I and C applications

With APAR PH47453 in Db2 12 and Db2 13, DCLGEN now supports the decimal floating-point (DECLFLOAT) data type for PL/I and C applications. 

Before this APAR, DCLGEN didn’t support the DECFLOAT datatype, and it couldn’t generate the DECFLOAT data type columns in PL/I and C applications. Instead, it just left blanks in the corresponding field, which couldn’t be used in the applications without customers manually rewriting it. This required a significant additional effort for Db2 customers.

The following example shows the DCLGEN declaration for table with DECFLOAT data type columns for a PL/I application.

CREATE TABLE TESTDCLGEN (C1 INT, C2 SMALLINT, C3 VARCHAR(2),                        

                         C4 BIGINT, C5 DECFLOAT(16),

                         C6 DECFLOAT(34));




DCL 1 DCLTESTDCLGEN,                                        

     5 C1       BIN FIXED(31),                              

     5 C2       BIN FIXED(15),                              

     5 C3       CHAR(2) VAR,                                

     5 C4       BIN FIXED(63),                              

     5 C5       DEC FLOAT(16),

     5 C6       DEC FLOAT(34);

For more information about the data type support in DCLGEN, see Data types that DCLGEN uses for variable declarations.