Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visualage COBOL 3.0.7 ODBC sample link error

Status
Not open for further replies.

TonyG

Programmer
Nov 6, 2000
79
0
0
US

When i try to build the ODBC sample i got with VACOBOL 3.0.7, i get link
errors of :
error LNK2029: _SQLError@32 : unresolved external
error LNK2029: _SQLFreeEnv@4 : unresolved external
error LNK2029: _SQLConnect@28 : unresolved external
error LNK2029: _SQLAllocEnv@4 : unresolved external
error LNK2029: _SQLFreeStmt@8 : unresolved external
error LNK2029: _SQLTransact@12 : unresolved external
error LNK2029: _SQLAllocStmt@8 : unresolved external

Does anybody know how to fix this problem ?

Any help would be appreciated.

Thanks,
Tony

 
Maybe you didn't SQL compile the program? Those errors are showing that some "called" modules were not linked to the executable.
 
Hello Dimandja. Thanks for your reply.

I'm not sure if i need to SQL compile. The instructions only stated to have two compiler directives set and SQL was not one of them. I'm not sure if there is an SQL compiler directive.

I agree," Those errors are showing that some "called" modules were not linked to the executable.". The linker can't find the file that has those modules in it to link to.

Any other ideas ?

Thanks,
Tony
 
>The instructions only stated to have two compiler directives set and SQL was not one of them.

Are these instructions written in indelible ink? Suppose whoever wrote them simply overlooked something?

Furthermore, the SQL directive will usually only allow COBOL to provide SQL stubs. The COBOL/SQL compiler will then link the needed SQL routines to those stubs.

Give it a try.
 
Actually, there are no SQL statements in the program where i would be required to put in BEGIN EXEC SQL and END EXEC SQL.

However, i did go ahead and try the directive "SQL("") and it did not help.

Do you know where VisualAge COBOL looks for libraries when compiling ?

Thanks again,
Tony
 
Are there any APIs in that program?

What directives are in use?
 
Look for CALL, ENTER, or any EXEC, for example.

AQlso, are there any other programs being called? If you rebuilt the object code, you would have to relink the other modules properly.

Did this program work before? What happened that you must (re)compile it?
 
Dimandja,

I am not using APIs. There are not ENTER or EXEC statements in the program, there are only CALLS to thing like: SQLConnect, SQLAllocHandle, SQLSetEnvAttr, SQLFreeHandle, SQLDisconnect, SQLGetDiagField. There are no calls to any other programs.

This is not a program that i developed. It is a sample program that comes with the VisualAge COBOL package that gives an example of how to develop an ODBC connection program.

Thanks again,
Tony
 
I am using a Windows XP standalone PC with service pack 1.

I do have on-line docs. No help there.

I did try the link that you supplied. It seems to talk about the same subject, but for DB2, which i am not using.

Thanks,
Tony
 
Do you know what database you'll be connected to? These APIs will try to access a database: SQLConnect, SQLAllocHandle, SQLSetEnvAttr, SQLFreeHandle, SQLDisconnect, SQLGetDiagField.

The link I provided has information on how to build your executable, and how to link it to SQL routines. For example, there is a precompile step before binding.

How exactly did you compile this program?

Also, what directives are currently used?
 
Dimandja,

If i ever get this to work, i will attempt to connect to a Pervasive Database. But, that's not really the problem. I need to get it to compile and execute before i can even attempt to test the connection to Pervasive/Btrieve.

I simply compile by clicking on the BUILD toolbar button in the Project Manager. The directives in use during the compile are "PGMNAME(MIXED),CALLINT(SYSTEM),SQL("")".

I will look at your link again and try to see how it applies to my problem.

Thanks again for your help.

Tony
 
I do not use SQL in VisualAge Cobol,
but I have occasionally LNK2029@999 when prog A calls prog B and linkage area in prog B does not exactly match the number of referenced areas in prog A. And the number 999 to the right of the @ sign points to the length, ie,
if you have:
CALL 'B' USING X, Y, Z and prog 'B' has only X in linkage section,

then you'll have LNK2029@16. (8 X 2)

Not sure if this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top