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
 
Regarding cursor status.

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

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Thu May 22, 2008 11:13 am    Post subject: Regarding cursor status.
Reply with quote

I have a read onlycursor.
After fetching the record i have to update another table.After updating the record i do not have any commit statement.Di it will effect the cursor.I mean the cursor will be closed or will be in normal state.
I mean do i need to declare cursor with hold option.
Back to top
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu May 22, 2008 11:19 am    Post subject:
Reply with quote

If you are not committing the Cursor1 and you are updating a table which is not related to Cursor1 then, i dont see any need of declaring the Cursor1 with HOLD option.
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Thu May 22, 2008 11:45 am    Post subject:
Reply with quote

the_gautam wrote:
If you are not committing the Cursor1 and you are updating a table which is not related to Cursor1 then, i dont see any need of declaring the Cursor1 with HOLD option.


U mean that After Update if do not give commit then No need to declare teh cursor with hold option.

Suppose in taht case if any abend occured during the cursor process u mena that all the updated records are rolled back..
Back to top
View user's profile Send private message
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu May 22, 2008 12:10 pm    Post subject:
Reply with quote

After reading your post, i thought you are talking about 2 different tables. Table1 is updated and the cursor is declared for Table2. thats why i said that the cursor for table2 has nothing to do with table1.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Thu May 22, 2008 12:32 pm    Post subject:
Reply with quote

Hi,

Adding to Gautam post,

you are post is little bit confusing, see you are fetching read only table and move to the respective host variables and updating the another table.

Cursor can be declared for one table not for multiple tables at a time, you can update another table with out any worry, if you want to use with hold option you can use, it just keeps cursor to be opened after close cursor command.

But after close cursor command all the change made to table is committed.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu May 22, 2008 1:38 pm    Post subject:
Reply with quote

So as not to flame anyone directly:

CURSORs can be based on one table, two,3 or many. The same limit of number of tables referenced in a select statement is also applied to a cursor. You can not define an UPDATE cursor with and explicit or implicit JOIN.

A COMMIT affects every table in your Unit-of-Work.

If you issue COMMITs while using a CURSOR (and one should if the cursor will be large - more than several thousand rows), you need to use the WITH HOLD option, to prevent the cursor from closing at COMMIT.

ONLY a COMMIT can make changes permanent. CLOSEing a CURSOR only releases the result table, has no affect on db2's decision to make changes permenant or not.
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Thu May 22, 2008 4:06 pm    Post subject: Reply to: Regarding cursor status.
Reply with quote

Actually my doubt is when the records will be committed if i do not specify anf commit.
ie after the update statement or after closing the cursor.
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Thu May 22, 2008 6:40 pm    Post subject: Reply to: Regarding cursor status.
Reply with quote

Can any one throw some lite on this..
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu May 22, 2008 6:44 pm    Post subject:
Reply with quote

stly,

first of all, records have nothing to do with DB2 - rows.

and it is light not lite.


second, if you do not have an explicit COMMIT in your run-unit, then MVS will cause db2 to be called at successful eoj and db2 will issue a commit.
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Fri May 23, 2008 1:50 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
stly,

first of all, records have nothing to do with DB2 - rows.

and it is light not lite.


second, if you do not have an explicit COMMIT in your run-unit, then MVS will cause db2 to be called at successful eoj and db2 will issue a commit.


Thanks Dick.... thanks for correction also icon_biggrin.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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
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
This topic is locked: you cannot edit posts or make replies. session stuck in TPX with status ACL amitc23 CA Products 1 Tue Dec 13, 2016 12:53 pm

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