tags:

views:

530

answers:

3

I'm able to (on Windows XP) precompile, compile and link a sample (Fujitsu NetCobol) COBOL test program which contains embedded SQL. This test program is to read and display the number of rows in a DB2 (UDB 9.5 on Linux) database table.

At runtime I get following error message:

JMP0811I-U [PID:... TID:...] FAILURE IN LINKAGE RULES OR PARAMETER OF THE 'sqlgstrt' PROGRAM. PGM=DB2TST1

The precompile source code this error refers to looks as follows:

     * ... in WORKING-STORAGE section:

      01  SQLA-PROGRAM-ID.
       05 SQL-PART1 pic 9(4) COMP-5 value 172.
       05 SQL-PART2 pic X(6) value "AEAMAI".
       05 SQL-PART3 pic X(24) value "gBSdTdJY01111 2         ".
       05 SQL-PART4 pic 9(4) COMP-5 value 13.
       05 SQL-PART5 pic X(13) value "ADMINISTRATOR".
       05 SQL-PART6 pic X(115) value LOW-VALUES.
       05 SQL-PART7 pic 9(4) COMP-5 value 8.
       05 SQL-PART8 pic X(8) value "COBOL/DB".
       05 SQL-PART9 pic X(120) value LOW-VALUES.

      * .. in PROCEDURE DIVISION:

      *EXEC SQL CONNECT TO :DB-SERVER USER :DB-USER USING :DB-PWD
      *     END-EXEC
           CALL "sqlgstrt" USING
              BY CONTENT SQLA-PROGRAM-ID
              BY VALUE 0
              BY REFERENCE SQLCA

Does anybody know what this error message means?

A: 

Not really an answer, but since I can't make comments -

How are you mapping the DB host variables in your EXEC SQL statement with your CALL statement? I've never used Fujitsu NetCOBOL, but it seems to me like the order of values in your SQLA-PROGRAM-ID don't match the host variables in the EXEC SQL connection.

Does :DB-SERVER --> SQL-PART2, :DB-USER --> SQL-PART5, :DB-PWD --> SQL-PART3 ?

These aren't in order, so I don't see how the precompiler would make the match.

Eric H
Actually I don't: the code shown above is generated by the DB2 precompiler. More specific: the SQL-CA-PROGRAM-ID and the CALL statement are generated by the DB2 precompiler. The original code just was the EXEC SQL CONNECT... statement
Gio
+1  A: 

The error description was due to: *) the CHECK(LINKAGE) compiler option (only available in NetCOBOL for Windows, not for Linux) without this option, the error is still there, but even less descriptive

The actual error was due to: *) the CALL "sqlgstrt" USING ... generated by the DB2 precompiler implies the wrong (= COBOL) calling convention => manually changing the calls to CALL "sqlgstrt" WITH STDCALL LINKAGE USING... has resolved the runtime error

This solution implies changing the precompiler results though, so I'm still in search of a DB2 precompiler option to generate the right CALLs.

Gio
A: 

Hi Gio,

Did you manage to get your sample running ?

Have you found a .net implementation of the native DB2 interfaces, or managed to call IBM's unmanaged code from your .net (COBOL) applications ?

Where did you find Fujitsu sample, I think I have been looking in all samples, bud did not find any using static embedded sql.