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

Displaying error messages in DB2 procedures

Status
Not open for further replies.

dataforums

Programmer
May 3, 2005
25
US
can anyone plz tell me how to display the error messages in DB2 stored procedures? I need to catch the error message and insert into a status table to check the success of the program(stored procedure).

Thanks!!!
 
Hi dataforums,
I work on a mainframe, and the stored procedures run in their own address space, a started task called DB2?SPAS where the ? is a letter denoting Test, Acceptance or Production. Our stored procedures are written in Cobol and any error message and debugging aids are DISPLAYed and can be found in the output for the started task. This is generally only done in testing.

The error message and return code is passed back as an argument to the executing procedure, therefore there is no need to access a db2 table to pick up the error as it is already present in the calling procedure.

Hope this helps.

Marc
 
I think you are after the GET DIAGNOSTICS statement. The MESSAGE_TEXT and DB2_TOKEN_STRING should contain the information you want

Regards

Martyn Hodgson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top