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
 

 

What is meant by CURSOR WITH HOLD

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
lmadhavi

New User


Joined: 01 Mar 2006
Posts: 10

PostPosted: Thu Jun 08, 2006 7:24 pm    Post subject: What is meant by CURSOR WITH HOLD
Reply with quote

can any one of you please explain what is meant by CURSOR WITH HOLD.
and is the purpose of it?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jun 09, 2006 2:02 pm    Post subject:
Reply with quote

Hi,


If we declare the cursor with hold option will remain open even if ur program execution is complete.
All locks are released, except locks protecting the current cursor position of open WITH HOLD cursors.
In order to close this cursor u need to explitly close it(Close cursor)

Hope it will helpful
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Fri Jun 09, 2006 2:56 pm    Post subject:
Reply with quote

HI lmadhavi,

What happens is your CURSOR will get closed when it executes a COMMIT statement and then your program tries to FETCH that CURSOR, you'll get an error "CURSOR in a FETCH or CLOSE statement is not OPEN", SQL = -501.

CURSOR WITH HOLD option is used to get rid of this difficulty.

Hope I'm clear.

Cheers, Twissi.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Fri Jun 09, 2006 4:35 pm    Post subject:
Reply with quote

Hi twissi,

I completely agree with you.

Just to add to that, all cursors opened in the program gets closed and resources are released when program ends. In fact, commit is issued automatically when program ends.

Thanks,
Parikshit
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Fri Jun 09, 2006 6:24 pm    Post subject:
Reply with quote

In other words you have to declare a CURSOR with WITHHOLD option if you want to process the rows fetched even after COMMIT(If you dont explicitly COMMIT , COMMIT will be issued after the completion of LUW, Logical Unit Of Work)
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Fri Jun 09, 2006 7:44 pm    Post subject:
Reply with quote

parikshit123 wrote:
all cursors opened in the program gets closed and resources are released when program ends. In fact, commit is issued automatically when program ends.


Parikshit,

I thought the question was to differentiate between CURSOR & CURSOR WITHHOLD !!

In both the cases what you said (given in quote) will happen for sure!

Does this make sense?

Cheers, Twissi.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts How LOAD PROGRAM and LOAD on HOLD is ... pkmurali CICS 4 Tue May 03, 2016 6:26 pm


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