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

How can we check if the cursor is open


IBM Mainframe Forums -> ABENDS & Debugging
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nashaikh

New User


Joined: 30 Oct 2008
Posts: 3
Location: Pune, India

PostPosted: Thu Mar 26, 2009 11:16 am
Reply with quote

How can we check if the cursor is open before going for a fetch or close? One way is to set a flag if the cursor open fails and check this flag. What are the other options?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Mar 26, 2009 12:54 pm
Reply with quote

Quote:
How can we check if the cursor is open before going for a fetch or close? One way is to set a flag if the cursor open fails and check this flag. What are the other options?


write better code - if the open cursor fails no reason to proceed further
Back to top
View user's profile Send private message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Thu Mar 26, 2009 2:08 pm
Reply with quote

hi,
Quote:
How can we check if the cursor is open before going for a fetch or close? One way is to set a flag if the cursor open fails and check this flag. What are the other options?


write code - if the open cursor fails check the SQLCODE.
if SQLCODE = 0 THEN print the message OPEN CURSOR SUCCESSFULLY...

your program is written in COBOL means use DISPLAY statement or PLI means use PUT SKIP LIST statement..

now, u can try and let me know if you have any concerns..
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: Thu Mar 26, 2009 8:12 pm
Reply with quote

Hello,

Quote:
How can we check if the cursor is open before going for a fetch or close? One way is to set a flag if the cursor open fails and check this flag. What are the other options?
Suggest you completely leave this line of thought behind.

When you issue the cursor open, immediately check to see if it was successful. If it was not, terminate the run with an appropriate message and show the error that was given by db2.

There is no need to set and check some indicator later if the open fails.
Back to top
View user's profile Send private message
nashaikh

New User


Joined: 30 Oct 2008
Posts: 3
Location: Pune, India

PostPosted: Mon Mar 30, 2009 11:33 am
Reply with quote

thanks all for the suggestions. i got what i needed.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Mar 30, 2009 6:08 pm
Reply with quote

nashaikh wrote:
i got what i needed.
If you share the solution used, it would be good for others who are looking solution for similar kind of problem . . .
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 -> ABENDS & Debugging

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to check whether who renamed the ... JCL & VSAM 3
No new posts No ++JCLIN, APPLY CHECK job JCL & VSAM 1
Search our Forums:

Back to Top