IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to handle cursor error codes in sub program?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
babu_hi

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Mon May 12, 2008 1:59 pm
Reply with quote

I have a sub program with cursor diclaration,now i want to return the sqlcode and sqlerrmsg to main program.i have declared linkage section like this,

05 LK-MESSAGE-TEXT PIC X(80).
05 LK-SQLCODE PIC S9(9) COMP-4.
05 LK-SQLERRM.
49 LK-SQLERRML PIC S9(4) COMP-4.
49 LK-SQLERRMC PIC X(70).
Here for excample i am handling open cursor error,
EXEC SQL
OPEN CONTROL_TABLE_CSR
END-EXEC.

IF SQLCODE NOT = +0
MOVE 'OPEN CURSOR ERROR' TO LK-MESSAGE-TEXT
MOVE ’04’ TO LK-RETURN-STATUS
MOVE SQLCODE TO LK-SQLCODE
END-IF.

but how can i use for error handle with LK-SQLERRM variable in this case.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 12, 2008 2:31 pm
Reply with quote

If you have mis-designed these programs so much that you can't provide proper error handling, suggest that you pass the sqlca as a parm. then in the sub-module, use the sqlca in linkage. that way you don't have to fool around with sql return codes.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top