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
 
ROLLBACK for previous table updates

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

New User


Joined: 10 Oct 2006
Posts: 40

PostPosted: Tue Apr 24, 2007 9:56 am    Post subject: ROLLBACK for previous table updates
Reply with quote

Hi

We need to code a program that will be updating/inerting/deleting into tables T1,T2,T3,T4 and T5. When there is failure in one of the operations, all the previous updates need to be rolled back.

For example, consider the below scenario

New row is inserted into table T1 which is succesfull
A row is deleted from table T2 which is succesfull
When I try to insert record into table T3, I get an error.

In the above scenario, the updates to T1 and T2 need to be backed out. Could anyone please let me know if there is a simple solution to this problem.

Thanks
Sowmya
Back to top
View user's profile Send private message

ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Tue Apr 24, 2007 12:10 pm    Post subject:
Reply with quote

Hi,

Its simple use a flag as WI-Rollback, and set this flag if any one of the T1,T2 or T3 sqlcode not equal to zero.

And after the three table processing check as

If WI-Rollback

Rollback db2 command


Cheers
Ashwin
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Tue Apr 24, 2007 12:21 pm    Post subject:
Reply with quote

Do you understand the concept of LUW? All inter-related operations are considered to a Logical Unit of Work. Once all parts of the LUW are successfully completed, commit the LUW to make the updates permanent. If there is a failure of any of the parts of the LUW, issue a rollback and all the other parts of the LUW will be reversed.
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 it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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