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: 6968
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 Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Compiling program in endeavor for tra... RALAKKAL Compuware & Other Tools 4 Mon Jun 05, 2017 8:27 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm


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