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

Handle RC while opening the cursor


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
moumi das
Warnings : 1

New User


Joined: 21 Dec 2009
Posts: 10
Location: Kolkata

PostPosted: Sat Oct 30, 2010 9:24 am
Reply with quote

Hi,

I would like to which one of the following is good cobol program writing practice:
Should we handle return code while declaring a cursor OR
it is enough if we handle RC while opening the cursor?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Oct 30, 2010 10:17 am
Reply with quote

Hello,

What error codes have you seen that were caused by a DECLARE CURSOR?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Oct 30, 2010 5:47 pm
Reply with quote

if you look at the compiler listing, there is no code generated for the declare cursor, so no need to check the sqlcode. actually the declare cursor (in addition to other things) is part of the DSNSQL SECTION which is executed as soon as your program is invoked (the first time).

So, if you declare a cursor and then check the sqlcode that has not been initialized, you are using either garbage from the module load or the sqlcode of a previous db2 call.

so, NO. no sqlcode check after a declare cursor - a mistake that many make.
Back to top
View user's profile Send private message
moumi das
Warnings : 1

New User


Joined: 21 Dec 2009
Posts: 10
Location: Kolkata

PostPosted: Tue Nov 02, 2010 9:53 am
Reply with quote

Thanks icon_biggrin.gif
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 DB2 for z/OS and LUW Admin Job Opening Mainframe Jobs 0
No new posts Looking For a PDS Member Without Open... PL/I & Assembler 10
No new posts Vision PLUS Mainframe opening Mainframe Jobs 0
No new posts Urgent MF opening for TCS India Mainframe Jobs 0
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
Search our Forums:

Back to Top