MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Rexx/DB2 Error Handling

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
grimpeur
Beginner


Joined: 10 Jul 2006
Posts: 16
Topics: 5

PostPosted: Fri Aug 15, 2008 11:16 am    Post subject: Rexx/DB2 Error Handling Reply with quote

Hi,

I am bringing myself up to speed with Rexx/DB2 appl. programming and have a query regarding error message handling.
If I get a negative SQL code in my program I would like to display the meaningful DB2 error message, such as:-

-904 UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE. REASON 00C90081, TYPE OF RESOURCE 00000210, AND RESOURCE NAME DDBDATA .SDBTS1 .00000001

I can display the content of SQLERRMC, but this just gives me the variable parts of the above message (reason-code, resource-type and resource-name), as follows...

00C90081:00000210:DDBDATA .SDBTS1 .00000001

Is there a technique for generating the entire message complete with meaningful text?

Apologies if I missed something obvious - I haven't used Rexx much at all so please be gentle!

Thanks!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Aug 15, 2008 11:35 am    Post subject: Reply with quote

grimpeur,

The table partition DDBDATA .SDBTS1 .00000001 is stopped. You need to find out the reason as to why the partition is stopped

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
grimpeur
Beginner


Joined: 10 Jul 2006
Posts: 16
Topics: 5

PostPosted: Fri Aug 15, 2008 1:32 pm    Post subject: Reply with quote

Sorry for any confusion - I stopped the TS deliberately to simulate an error.

My question is can I get from anywhere the full text of the error message (in this case "-904 UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE.... etc etc...") rather than just the variable parts of it, so that this can be displayed/output as a meaningful error message when the program abends?

At the moment, I only seem to be able to display the variable parts, ie 00C90081:00000210:DDBDATA .SDBTS1 .00000001 which represent the reason-code, resource-type and resource-name. However this is not that great without the full text of the -904 message.

It's not just -904s I'm concerned about - I would like to provide a full error message with text and variables merged together when the prog ends.

Should I have posted this in the Application Programming fourm?

Thanks again.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Aug 15, 2008 2:03 pm    Post subject: Reply with quote

Not 100% certain on this but I think you would have to hardcode all the error messages in your rexx program and have an error routine that will complete the message before displaying it. I always found that the return code and reason code were sufficient but I was only using one table at a time.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Aug 15, 2008 2:34 pm    Post subject: Reply with quote

grimpeur,

You can copy all the Error codes and messages listed in here and format the message

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNMCJ12/CCONTENTS

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Fri Aug 15, 2008 3:38 pm    Post subject: Reply with quote

I think if you return the contents of SQLCA.SQLMSG you can return the error message you have shown above.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Sat Aug 16, 2008 12:52 am    Post subject: Reply with quote

Can I assume that REXX cannot call 'DSNTIAR' like COBOL can?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
grimpeur
Beginner


Joined: 10 Jul 2006
Posts: 16
Topics: 5

PostPosted: Sat Aug 16, 2008 3:52 am    Post subject: Reply with quote

Hardcoding all the possible error messages is not a realistic option. I'm amazed there isn't an obvious way of doing this!
Thanks for the responses though... I tried displaying SQLCA.SQLMSG but could not get that to work - also I couldn't find any reference to SQLMSG in the manual.
Will investigate use of DSNTIAR but would welcome any further comments in the meantime.
Thanks.
Back to top
View user's profile Send private message
IEFBR14
Beginner


Joined: 13 Aug 2008
Posts: 17
Topics: 0
Location: SYS1.LINKLIB

PostPosted: Mon Aug 18, 2008 10:51 am    Post subject: Reply with quote

You can call DSNTIAR from Rexx
Back to top
View user's profile Send private message
grimpeur
Beginner


Joined: 10 Jul 2006
Posts: 16
Topics: 5

PostPosted: Mon Aug 18, 2008 2:17 pm    Post subject: Reply with quote

Thanks IEFBR14 I will look into that (unless anybody has a code snippet they would be willing to share Laughing )
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Aug 18, 2008 3:57 pm    Post subject: Reply with quote

untested code collected from the net




Code:

/ *  REXX  */
PARSE UPPER ARG SQLCODE UPPER PARSE ARG SQLCODE
SQLC = D2X(SQLCODE,8) SQLC = D2X (SQLCODE, 8)
SQLC = X2C(SQLC) SQLC = X2C (SQLC)

SQLCA = 'SQLCA   ' SQLCA = 'SQLCA'
SQLCA = SQLCA !! SQLCA = SQLCA!  X2C(00000088) X2C (00000088)
SQLCA = SQLCA !! SQLCA = SQLCA!  SQLC SQLC
SQLCA = SQLCA !! SQLCA = SQLCA!  X2C(0000) X2C (0000)
SQLCA = SQLCA !! SQLCA = SQLCA!  COPIES(' ',78) COPIES ( '', 78)
SQLCA = SQLCA !! SQLCA = SQLCA!  COPIES(X2C(00),24) COPIES (X2C (00), 24)
SQLCA = SQLCA !! SQLCA = SQLCA!  COPIES(' ',16) COPIES ( '', 16)
TIAR_MSG = X2C(0190)COPIES(' ',400) TIAR_MSG = X2C (0190) COPIES ( '', 400)
TEXT_LEN = X2C(00000050) ; TEXT_LEN = X2C (00000050);
ADDRESS ATTCHPGM 'DSNTIAR SQLCA TIAR_MSG TEXT_LEN' ADDRESS ATTCHPGM 'DSNTIAR SQLCA TIAR_MSG TEXT_LEN'
SAY SUBSTR(TIAR_MSG,4,400); SAY SUBSTR (TIAR_MSG, 4.400);


You can also check this out

http://www.ibm.com/developerworks/exchange/dw_entryView.jspa?categoryID=27&externalID=287
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group