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 can we check if the cursor is open

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Thu Mar 26, 2009 12:54 pm    Post subject: Reply to: how to resolve the sql code -501
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    Post subject:
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

Site Director


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

PostPosted: Thu Mar 26, 2009 8:12 pm    Post subject:
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    Post subject: Reply to: how to resolve the sql code -501
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

Senior Member


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

PostPosted: Mon Mar 30, 2009 6:08 pm    Post subject: Re: Reply to: how to resolve the sql code -501
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    IBMMAINFRAMES.com Support Forums -> ABENDS & Debugging All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts FTOPEN TEMP is failing due to dataset... mbenaud TSO/ISPF 7 Thu Jul 28, 2016 4:28 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


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