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
 

 

How to set commit point

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

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Mon Jan 15, 2007 12:01 pm    Post subject: How to set commit point
Reply with quote

Hi,

I have written a program which inserts rows. The entire program works in a loop.So each time it goes into the loop rows will be inserted in three tables.

I have to roll back all the rows I have inserted through the current execution of the program, if any sql errors happens during execution.

Could you please explain me how I can do this. For this I have to set commit point (Synch point) at the beginning of the program and roll back the changes till that point. If you have ever done this, please help me.

Thank you,

Shanu
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jan 15, 2007 12:29 pm    Post subject:
Reply with quote

hi
i dont think u need to set a commit at the beginning of the loop ... just do a normal rollback if any error happens within the loop ....
Back to top
View user's profile Send private message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Mon Jan 15, 2007 12:33 pm    Post subject:
Reply with quote

Will that roll back all the rows inserted throgh the program? I think that will roll back the insert done at that point of time. Please corerct me if I am wrong.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 1:07 pm    Post subject:
Reply with quote

Hi Shanu,

A rollback will affect every insert done in that Logical Unit of Work. The LUW started at the first DB operation (or the last syncpoint) and will continue until the program ends or issues a rollback (or syncpoint).

Does that answer your question?

Bill
Back to top
View user's profile Send private message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Mon Jan 15, 2007 1:48 pm    Post subject:
Reply with quote

Thanks.... I was confused about where the LUW starts and now I am clear.
Back to top
View user's profile Send private message
adarsha

New User


Joined: 28 Dec 2006
Posts: 8
Location: Noida,Delhi

PostPosted: Mon Jan 15, 2007 4:48 pm    Post subject: Re: How to set commit point
Reply with quote

Shanu.sukoor wrote:
Hi,

I have written a program which inserts rows. The entire program works in a loop.So each time it goes into the loop rows will be inserted in three tables.

I have to roll back all the rows I have inserted through the current execution of the program, if any sql errors happens during execution.

Could you please explain me how I can do this. For this I have to set commit point (Synch point) at the beginning of the program and roll back the changes till that point. If you have ever done this, please help me.

Thank you,

Shanu



hi shanu,

There are lots of ways to do the roll back. first thing is that whether your program is file driven or Database Driven.

if its file drive once again whether its Vsam, Sequential, GSAM or any type of file driven.

File Driven roll Back,

if your program is reading any above mentioned type of files then you can take the check point of each record before populating the DB relations. After updating any DB obiously you check the SQL codes. there you can fix the logic whether you can rooll back is done to any destination files.

If you want to retrieve all the rows inserted then you need to commit each and every record.

i think its not a friendly logic under that situation when you need to handle lacks of record (usually).


let me know if you are cleared with this or not!!!!
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 5:05 pm    Post subject: Re: How to set commit point
Reply with quote

adarsha wrote:
There are lots of ways to do the roll back. first thing is that whether your program is file driven or Database Driven.

if its file drive once again whether its Vsam, Sequential, GSAM or any type of file driven.

File Driven roll Back,

if your program is reading any above mentioned type of files then you can take the check point of each record before populating the DB relations. After updating any DB obiously you check the SQL codes. there you can fix the logic whether you can rooll back is done to any destination files.

If you want to retrieve all the rows inserted then you need to commit each and every record.

i think its not a friendly logic under that situation when you need to handle lacks of record (usually).

let me know if you are cleared with this or not!!!!
I am not clear with this????
Back to top
View user's profile Send private message
DavidatK

Active Member


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

PostPosted: Tue Jan 16, 2007 3:59 am    Post subject: Re: How to set commit point
Reply with quote

Shanu, Check this previous post

DISCUSSION on COMMIT, ROLLBACK, CHECKPOINT
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 Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
No new posts Commit limit for Delete query through... mf_karthik DB2 10 Thu Dec 17, 2015 12:56 am
No new posts Commit a DB2 Table on Unix Server and... Vinodh S DB2 3 Sun Apr 12, 2015 5:05 am
No new posts how to convert fixed-point data forma... Roland Brosio DFSORT/ICETOOL 4 Mon Mar 16, 2015 6:16 pm
No new posts ICETool : manipulating floating point... Frank Cukerman DFSORT/ICETOOL 9 Tue Feb 17, 2015 9:23 pm


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