Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
how to handle cursor error codes in sub program?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: how to handle cursor error codes in sub program?
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: 6970
Location: porcelain throne

PostPosted: Mon May 12, 2008 2:31 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us