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

SQL-status-code to know wheter the cursor is opened or not


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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: 1448
Location: Chicago, IL

PostPosted: Fri Sep 08, 2006 9:13 am
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to turn off 'ACTION' SDSF output ... TSO/ISPF 2
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Job completes in JES, but the status ... IBM Tools 1
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top