Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us