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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

no connect sql/cobol csbctxglobal

Status
Not open for further replies.

hmabilai

MIS
Nov 23, 2000
5
US
We have Sybase Adaptive Server version 12.0 on Windows NT 4.0. The connect statement works in isql and we are able to use the user tables (select, etc.). However when running an application program compiled with SQL/COBOL (cobpre and then Merant NetExpress 3.1 for Windows NT), the Connect statement does not work. The syntax used is:

EXEC SQL CONNECT :USERID IDENTIFIED BY :pASSWO END-EXEC.

The Sybase pre-compiler translates the call as

CALL "CSBCTXGLOBAL" USING SQL--CS-VERSION
SQL--RETCODE SQL--CTX OF SQL--HANDLES
IF SQL--RETCODE NOT EQUAL CS-SUCCEED
MOVE 25001 TO SQL--INTRERR
PERFORM SQL--CTXERR
END-IF

SQL-RETCODE is returned as 0 and not equal to CS-SUCCEED (which is 1). We have also tried changing the connect by specifying USING :SVR and/or specifying some pre-compiler options such as –U –P –D –S (user, password, database, server) or –e. The result is always the same, fail on this call to CSBCTXGLOBAL.

Thanks for any tips on how to resolve this problem.
 
COBOL sources can be compiled with Sybase pre-compiler 12.0 (cobpre) provided you use the include files from a prior version of the pre-compiler (we used 11.1) in the OCS-12_0\Include directory (simply override files with the same name in that directory). The filenames are Cobpub.cbl, Sybhesql.cbl and Sybtesql.cbl. These 3 COBOL files are included by the pre-compiler into the COBOL source file (.cbl resulting from pre-compiling the .pco). If you use version 12.0 of these files, you get the invalid context message, however if you use version 11.1, you are able to connect to the database. Looking at the 2 versions of these files, it seems the major difference is that in version 11.1, the variables are defined as comp-5 while in version 12 they are defined as comp. I think we may also have change the value of CS-VERSION-100 in the Cobpub.cbl file to 112 (instead of 1100), but I am not sure if it is actually necessary to do so.

Not sure what the exact explanation is, but it may be that COBOL comp-5 variables are compatible with the Sybase dlls (such as libcobct.dll, probably written in C/C++) whereas comp variables are not.

In any case, nothing else need to be changed from the standard installation of Adaptive Server 12.0, only these 3 files in the Include directory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top