Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SQL-status-code to know wheter the cursor is opened or not

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Narasimha_chintu

New User


Joined: 28 Aug 2005
Posts: 3

PostPosted: Wed Sep 06, 2006 1:29 pm    Post subject: SQL-status-code to know wheter the cursor is opened or not
Reply with quote

When we open cursor and process some statements and call other programs, sometimes the cursor may get closed even before closing the cursor explicitely.

If the cursor is closed, then we can open the cursor again.

For this, I would like to know whether we have any option to know the cursor is still opened OR closed i.e. the status of the cursor.

Note: I can not use the SQL-status-code to know wheter the cursor is opened or not. It is because I will process many SQL statements in between. So the SQL-status-code will show the status of last processed SQL statement.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Sep 06, 2006 7:45 pm    Post subject: Re: SQL-status-code to know wheter the cursor is opened or n
Reply with quote

What condition is causing the cursor to close? There should be a way around this. Having to re-open and re-position youself in the cursor is pretty costly.

Dave
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Sep 08, 2006 9:13 am    Post subject: Re: SQL-status-code to know wheter the cursor is opened or n
Reply with quote

Quote:
For this, I would like to know whether we have any option to know the cursor is still opened OR closed i.e. the status of the cursor.

I would could another OPEN CURSOR statement where you want to check & if getting -502 things are fine else if +000 It is opened again; rest all ABEND.
Quote:
Note: I can not use the SQL-status-code to know wheter the cursor is opened or not. It is because I will process many SQL statements in between. So the SQL-status-code will show the status of last processed SQL statement.

I dont understand this. Why cant you use SQLCODE. Number of times you are executing any SQL statement you'll get an SQLCODE.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Sep 08, 2006 9:21 pm    Post subject: Re: SQL-status-code to know wheter the cursor is opened or n
Reply with quote

Narasimha_chintu,

Come back and let us know if you have a resolution to your problem.

If not it could be as simple as adding 'WITH HOLD' to you Cursor.

Check the link below to the DB2 Manual


DECLARE CURSOR

Dave
Back to top
View user's profile Send private message
tanky

New User


Joined: 19 Jun 2006
Posts: 1

PostPosted: Fri Sep 08, 2006 9:59 pm    Post subject:
Reply with quote

hEY

I Dont think is there any way get away from it icon_razz.gif
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 IBEGENER RETURN CODE 12 anilkumar922 All Other Mainframe Topics 5 Wed Dec 13, 2017 11:41 am
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us