DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 30th, 2006, 04:36 PM
needlottahelp needlottahelp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 1 needlottahelp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 48 sec
Reputation Power: 0
Sqlca reason-code

Hello,

I am new to database development in general. I am using db2 v8.2 and was trying to decipher the sqlcode reason-code. I am working in error recovery so I need to be able to read these reason-codes when an error happens (if they exist) to determine what I need to do to recover (if anything).

From what I have found so far it looks like the reason-code is placed in sqlca->sqlerrmc. Can anyone verify that?

sqlerrmc is a VARCHAR (70) and I see some references such as : "sqlerrmc VARCHAR (70) Contains one or more tokens, separated by X'FF', which are substituted for variables in the descriptions of error conditions. "

In the minimal amount of sqlcodes I am seeing so far that have a reason-code, I am not seeing the X'FF' stated above...and I am not seeing the expected reason-code for that sqlcode either.

BTW, this is in code and without using any db2 api's to display. I am trying to determine how to best extract the reason-code from the sqlerrmc (if that is where it is). Does anyone have any information on this?

Thanks

Reply With Quote
  #2  
Old June 1st, 2006, 10:39 AM
Randux Randux is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 48 Randux User rank is Corporal (100 - 500 Reputation Level)Randux User rank is Corporal (100 - 500 Reputation Level)Randux User rank is Corporal (100 - 500 Reputation Level)Randux User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 18 h 47 m 23 sec
Reputation Power: 6
I don't have the manuals in front of me. There is a callable service that returns a formatted error message based on an input sqlca. Check the Programmer's Guide for details.

Reply With Quote
  #3  
Old June 14th, 2006, 11:00 AM
OS2dude OS2dude is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 3 OS2dude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 4 sec
Reputation Power: 0
Getting SQLDA diagnostic data

According to the DB2 manual, the way you get diagnostic info is by calling GET DIAGNOSTICS. Here is a bit of code to help. The Token String is what contains the values seperated by '0xFF'. You can look up the function in the SQL book for more details.

(BTW, you don't NEED all the variables. I was trying to track a problem and dumped as much as I thought might be remotely useful.)

RPG Embedded SQL Code:
Original - RPG Embedded SQL Code
    D dasqlcode       S             10I 0        D datokencnt      S             10I 0        D datoken1        S          32740A   VARYING D datoken2        S          32740A   VARYING D datoken3        S          32740A   VARYING D datoken4        S          32740A   VARYING D datoken5        S          32740A   VARYING D datokenstr      S             70A   VARYING D dasqlerrdid     S             10A          D dasqlerrd1b     S              7A   VARYING D dasqlerrd2b     S              7A   VARYING D damsgtext       S          32740A   VARYING C/EXEC SQL                                  C+ GET CURRENT DIAGNOSTICS CONDITION 1      C+     :dasqlcode   = DB2_RETURNED_SQLCODE, C+     :datokencnt  = DB2_TOKEN_COUNT,      C+     :datoken1    = DB2_ORDINAL_TOKEN_1,  C+     :datoken2    = DB2_ORDINAL_TOKEN_2,  C+     :datoken3    = DB2_ORDINAL_TOKEN_3,  C+     :datoken4    = DB2_ORDINAL_TOKEN_4,  C+     :datoken5    = DB2_ORDINAL_TOKEN_5,  C+     :datokenstr  = DB2_TOKEN_STRING,      C+     :dasqlerrdid = DB2_MESSAGE_ID,        C+     :dasqlerrd1b = DB2_MESSAGE_ID1,      C+     :dasqlerrd2b = DB2_MESSAGE_ID2,      C+     :damsgtext   = MESSAGE_TEXT          C/END-EXEC

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Sqlca reason-code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway