Using Gen 8.6 Window Packaged (GUI) application targeting DB2.
Have modified 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 stubdbmsn.mak all
However this error is received:
*****...
MAKEDDL: MAKE Completed OK
STUBDB2N: Returning to Stubdb2n.mak
The file cannot be copied onto itself.
0 file(s) copied.
NMAKE : fatal error U1077: 'copy' : return code '0x1'
Stop.
*****
Gen 8.6 with latest PTFs applied.
There are some problems with the current STUBDB2N.MAK file (last updated in PTF WKS86300)
1. To fix the reported error remove line 190 (a copy statement) as follows:
!IFNDEF INTERNAL_BUILD
"$(INTDIR)\$(EXENAME).c" : "$(SOURCE_DIR)\$(EXENAME).sqc"
@copy $** $(*B).sqc
!if "$(AEUSER)"==""
@echo STUBDB2N: Precompiling DB2 Stub without AEDB, AEUSER or AEPASSWORD set
@"$(GEN86)Gen\$(GEN_BITS_DIR)\tidb2prp" $(INCL) /INAME=$(*B).sqc /DB=$(AEDB) > $(*B).out 2>&1
!else
@echo STUBDB2N: Precompiling DB2 Stub
@"$(GEN86)Gen\$(GEN_BITS_DIR)\tidb2prp" $(INCL) /INAME=$(*B).sqc /DB=$(AEDB) /USER=$(AEUSER) /PASSWORD=$(AEPASSWORD) > $(*B).out 2>&1
!endif
2. Later errors were also found after which the STUBDB2N.SQC source file was also deleted :
*****...
MAKEDDL: MAKE Completed OK
STUBDB2N: Returning to Stubdb2n.mak
STUBDB2N: Precompiling DB2 Stub
STUBDB2N: Compiling DB2 Stub
STUBDB2N.c
STUBDB2N: Resource Compiling DB2 Stub
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation. All rights reserved.
STUBDB2N: Linking DB2 Stub
cl : Command line warning D9024 : unrecognized source file type 'C:\Program', object file assumed
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
*****
The above was due to STUBDB2N.MAK not having variable DB2LIBS
quoted.
However to ensure the 32-bit DB2 db2api.lib is used (from directory "C:\Program Files\IBM\SQLLIB\lib\Win32") this change is required so that the library is picked up from the LIB environment variable and DB2PATH is then no longer used.
Change this section:
!IFDEF INTERNAL_BUILD
DB2LIBS = db2api.lib
!ELSE
DB2LIBS = $(DB2PATH)\lib\db2api.lib
!ENDIF
To:!IFDEF INTERNAL_BUILD
DB2LIBS = db2api.lib
!ELSE
DB2LIBS = db2api.lib
!ENDIF
3. Also delete this line to stop the STUBDB2N.SQC source file being deleted:@del $(*B).sqc
Attached is a copy of an updated STUBDB2N.MAK file provided by Gen Engineering which resolves all the above problems.
This will be released in a future Gen 8.6 PTF.