Skip to main content

In converting a system from DB2 to ODBC I have discovered (I think) that the previous SQL codes that were returned by DB2 are now different when using ODBC. For example I have just had a -19519 error. When I looked at it it was a 'cursor not open' error. The code currently looks for a -501 error. This may or may not be a major issue. The codes are all stored in a copy library so it may be easy(ish) to change:

           78  WS-FILE-DBMWRONGCOLS            VALUE -117.
           78  WS-FILE-DBMINDNOTFOUND          VALUE -204.
           78  WS-FILE-DBMNAMENOTFOUND         VALUE -204.
           78  WS-FILE-OUTOFRANGE              VALUE -406.
           78  WS-FILE-DBMCURNOTOPEN           VALUE -501.
           78  WS-FILE-DBMNOFOREIGNKEY         VALUE -530.
           78  WS-FILE-DBMKEYINUSE             VALUE -532.
           78  WS-FILE-DBMPKEYNOTFOUND         VALUE -539.
           78  WS-FILE-DBMFKEYEXISTS           VALUE -601.
           78  WS-FILE-DBMINDEXISTS            VALUE -601.
           78  WS-FILE-DBMNAMEEXISTS           VALUE -601.
           78  WS-FILE-DBMKEYDUPL              VALUE -803.
           78  WS-FILE-DBMDEADLOCK             VALUE -911.
           78  WS-FILE-DBMLOGFILEFULL          VALUE -9999999.
           78  WS-FILE-DBMDBEXISTS             VALUE -1005.
           78  WS-FILE-DBMWRONGCP              VALUE -1006.
           78  WS-FILE-DBMDBNOTFOUND           VALUE -1013.
           78  WS-FILE-DBMRESTART              VALUE -1015.
           78  WS-FILE-DBMNODEEXISTS           VALUE -1018.
           78  WS-FILE-DBMNOTSTARTED           VALUE -1032.
           78  WS-FILE-DBMINUSE                VALUE -1035.
           78  WS-FILE-DBMFORCED               VALUE -1224.
           78  WS-FILE-DBMUTILFAIL             VALUE -2010.

           78  WS-FILE-DBMOK                   VALUE 0.
           78  WS-FILE-DBMWARN                 VALUE 1.
           78  WS-FILE-DBMNOTFOUND             VALUE 100.
           78  WS-FILE-DBMFKEYDUPL             VALUE 541.
           78  WS-FILE-DBMINDUSED              VALUE 598.
           78  WS-FILE-DBMINDFOUND             VALUE 605.
           78  WS-FILE-DBMLOADMEDIA            VALUE 2031.
           78  WS-FILE-DBMENDOFMEDIA           VALUE 2058.
           78  WS-FILE-DBMDEVICEFULL           VALUE 2059.
           78  WS-FILE-DBMRESTEXISTS           VALUE 2505.
           78  WS-FILE-DBMRESTMIGRATE          VALUE 2517.
           78  WS-FILE-DBMRESTCONFIG           VALUE 2520.
           78  WS-FILE-DBMRESTSEEDDIFF         VALUE 2523.
           78  WS-FILE-DBMRESTNAMEXISTS        VALUE 2528.
           78  WS-FILE-DBMRESTDIFFXISTS        VALUE 2529.
           78  WS-FILE-DBMRESTOREEXISTS        VALUE 2539.
           78  WS-FILE-DBMRESTUPGRADED         VALUE 2555.
           78  WS-FILE-DBMIMPORTWARN           VALUE 3107.

Does anybody have a list of what the equivalent codes are? I've tried searching and can't find it.


Regards


Ian

In converting a system from DB2 to ODBC I have discovered (I think) that the previous SQL codes that were returned by DB2 are now different when using ODBC. For example I have just had a -19519 error. When I looked at it it was a 'cursor not open' error. The code currently looks for a -501 error. This may or may not be a major issue. The codes are all stored in a copy library so it may be easy(ish) to change:

           78  WS-FILE-DBMWRONGCOLS            VALUE -117.
           78  WS-FILE-DBMINDNOTFOUND          VALUE -204.
           78  WS-FILE-DBMNAMENOTFOUND         VALUE -204.
           78  WS-FILE-OUTOFRANGE              VALUE -406.
           78  WS-FILE-DBMCURNOTOPEN           VALUE -501.
           78  WS-FILE-DBMNOFOREIGNKEY         VALUE -530.
           78  WS-FILE-DBMKEYINUSE             VALUE -532.
           78  WS-FILE-DBMPKEYNOTFOUND         VALUE -539.
           78  WS-FILE-DBMFKEYEXISTS           VALUE -601.
           78  WS-FILE-DBMINDEXISTS            VALUE -601.
           78  WS-FILE-DBMNAMEEXISTS           VALUE -601.
           78  WS-FILE-DBMKEYDUPL              VALUE -803.
           78  WS-FILE-DBMDEADLOCK             VALUE -911.
           78  WS-FILE-DBMLOGFILEFULL          VALUE -9999999.
           78  WS-FILE-DBMDBEXISTS             VALUE -1005.
           78  WS-FILE-DBMWRONGCP              VALUE -1006.
           78  WS-FILE-DBMDBNOTFOUND           VALUE -1013.
           78  WS-FILE-DBMRESTART              VALUE -1015.
           78  WS-FILE-DBMNODEEXISTS           VALUE -1018.
           78  WS-FILE-DBMNOTSTARTED           VALUE -1032.
           78  WS-FILE-DBMINUSE                VALUE -1035.
           78  WS-FILE-DBMFORCED               VALUE -1224.
           78  WS-FILE-DBMUTILFAIL             VALUE -2010.

           78  WS-FILE-DBMOK                   VALUE 0.
           78  WS-FILE-DBMWARN                 VALUE 1.
           78  WS-FILE-DBMNOTFOUND             VALUE 100.
           78  WS-FILE-DBMFKEYDUPL             VALUE 541.
           78  WS-FILE-DBMINDUSED              VALUE 598.
           78  WS-FILE-DBMINDFOUND             VALUE 605.
           78  WS-FILE-DBMLOADMEDIA            VALUE 2031.
           78  WS-FILE-DBMENDOFMEDIA           VALUE 2058.
           78  WS-FILE-DBMDEVICEFULL           VALUE 2059.
           78  WS-FILE-DBMRESTEXISTS           VALUE 2505.
           78  WS-FILE-DBMRESTMIGRATE          VALUE 2517.
           78  WS-FILE-DBMRESTCONFIG           VALUE 2520.
           78  WS-FILE-DBMRESTSEEDDIFF         VALUE 2523.
           78  WS-FILE-DBMRESTNAMEXISTS        VALUE 2528.
           78  WS-FILE-DBMRESTDIFFXISTS        VALUE 2529.
           78  WS-FILE-DBMRESTOREEXISTS        VALUE 2539.
           78  WS-FILE-DBMRESTUPGRADED         VALUE 2555.
           78  WS-FILE-DBMIMPORTWARN           VALUE 3107.

Does anybody have a list of what the equivalent codes are? I've tried searching and can't find it.


Regards


Ian

The sqlcode values returned by OpenESQL can be found in the Net Express help under Programming-->Database Access-->Reference-->OpenESQL-->OpenESQL Messages-->SQLCODE messages.

These codes are also the same in Visual COBOL and can be found here:

There are some additional codes that can be returned but they are specific to the ODBC driver that you are using so you will have to check the documentation from your database vendor for these.