Created On:  15 April 2011

Problem:

When using Studio Enterprise Edition 6.0 to create a native Mainframe Subsystem project that uses the DB2 directive the following error occurs:
 
* Compiling C:\\BankDemoDB2\\CBL\\BBANK10P.CBL
* Generating obj\\x86\\Debug\\BBANK10P
* Data:           0     Code:        6896     Literals:        1656
   Creating library obj\\x86\\Debug\\BBANK10P.lib and object obj\\x86\\Debug\\BBANK10P.exp
BBANK10P.obj : error LNK2001: unresolved external symbol _SQLGSTRT@12
BBANK10P.obj : error LNK2001: unresolved external symbol _SQLGALOC@16
BBANK10P.obj : error LNK2001: unresolved external symbol _SQLGSTLV@28
BBANK10P.obj : error LNK2001: unresolved external symbol _SQLGCALL@20
BBANK10P.obj : error LNK2001: unresolved external symbol _SQLGSTOP@4
obj\\x86\\Debug\\BBANK10P.dll : fatal error LNK1120: 5 unresolved externals

Resolution:

This is because Studio Enterprise Edition 6.0 uses Visual Studio 2008 as the IDE and it generates .EXE and .DLL programs that need to be linked.
When using the DB2 compiler directive the programs need to be linked to the db2api.lib which can usually be found in the following folder:

C:\\Program Files (x86)\\IBM\\SQLLIB\\lib

There is a problem with the SEE 6.0 product where the Link Settings on the COBOL tab of the project properties page is grayed out and vcannot be accessed. This will be fixed in a future release but for now the workaround is to set the following environment variable to the location and name of the required db2 library:

SET LINK=C:\\Program Files (x86)\\IBM\\SQLLIB\\lib\\db2api.lib