Rebuild STUBDB2N.SQC - SQL0008N "DATABASE_LEN" host variable declaration not valid
search cancel

Rebuild STUBDB2N.SQC - SQL0008N "DATABASE_LEN" host variable declaration not valid

book

Article ID: 399346

calendar_today

Updated On:

Products

Gen Gen - Workstation Toolset

Issue/Introduction

Using Gen 8.6 Window Packaged (GUI) application targeting DB2.
Have modified Gen 8.6 STUBDB2N.SQC and trying to rebuild STUBDB2N.OBJ using STUBDB2N.MAK according to page: Windows Implementation Toolset > Rebuilding DBMS DLLs and Executables i.e. have a command script which sets required environment variables and runs nmake:

set DB2PATH=C:\Program Files\IBM\SQLLIB
set LIB=C:\Program Files\IBM\SQLLIB\lib\Win32;%LIB%
set AEDB=GENDB
set AEUSER=db2user
set AEPASSWORD=db2password
nmake -nologo -s -f stubdb2n.mak all


However this error is received:

...
MAKEDDL: MAKE Completed OK

STUBDB2N: Returning to Stubdb2n.mak

STUBDB2N: Precompiling DB2 Stub
NMAKE : fatal error U1077: '"C:\Program Files (x86)\CA\Gen86\Gen\.\tidb2prp"' : return code '0xffffffff'
Stop.


The STUBDB2N.OUT file created shows:

LINE    MESSAGES FOR STUBDB2N.sqc
------  --------------------------------------------------------------------
        SQL0060W  The "C" precompiler is in progress.
   45   SQL0008N  The token "DATABASE_LEN" found in a host variable 
                  declaration is not valid.
  189   SQL4911N  The host variable data type is not valid.
        SQL0095N  No bind file was created because of previous 
                  errors.
        SQL0091W  Precompilation or binding was ended with "3" 
                  errors and "0" warnings.

Environment

Gen 8.6 with 8.6.4 Consolidation PTF WKS86400.

Cause

There is a problem with the STUBDB2N.SQC coding for host variable DATABASE_LEN.

Resolution

The workaround is to hard code the DATABASE_LEN value in line 45 of STUBDB2N.SQC i.e. 

Change:

    Line  24: #define DATABASE_LEN 30
    Line  45: char Database[DATABASE_LEN];                            //  vuln fix
    Line 111:    strcpy_s(Database, DATABASE_LEN, szDatabase);   

To:
    Line  24: #define DATABASE_LEN 30
    Line  45: char Database[30];                            //  vuln fix
    Line 111:    strcpy_s(Database, DATABASE_LEN, szDatabase);   

Additional Information

This problem will be fixed in an upcoming new PTF RTN86403.
Gen 8.6 Solutions & Patches