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

How to set commit point


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 1:07 pm
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
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
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: 3156
Location: Tucson AZ

PostPosted: Mon Jan 15, 2007 5:05 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Point and Shoot )PTNS TSO/ISPF 0
No new posts A directory in the pathname was not f... ABENDS & Debugging 0
No new posts How to remove DECIMAL POINT (.) from ... SYNCSORT 10
No new posts filter COMMIT/ROLLBACK statements DFSORT/ICETOOL 13
No new posts Online Assembler Program Starting point PL/I & Assembler 4
Search our Forums:

Back to Top