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
 

 

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 Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am


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