MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 COMMIT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Fri Apr 15, 2005 1:31 pm    Post subject: DB2 COMMIT Reply with quote

Hi fellas,

i have a question for u all ...

i have jcl which has 2 steps each running a COB2BD program.

Step 1 :- Program1 has no exclusive commits in it ( it INSERTS table "A")

Step 2 :- Program2 has no exclusive commits in it ( it INSERTS table "A")

Now.. the questions is..

will the DB2 changes happen .. only when the JOB runs successfully
OR

DB2 changes happen when the steps running the Porgrams completes with MAXCC=0

Kolusu,

do u have any documentation on this ??


Thanks,
Tattva
Back to top
View user's profile Send private message
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Fri Apr 15, 2005 1:40 pm    Post subject: Reply with quote

I'm not 100% sure but, I believe when program one completes successfully it will do an 'AutoCommit'. Same for program two.
_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 15, 2005 2:03 pm    Post subject: Reply with quote

tattva,

Nascar is right on ! A Successful completion of the program will result in AUTOCOMMIT.

If the step1 completes successfully and step2 fails , then only the inserts in step2 are rolled back. The step1 inserts are commited !

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 15, 2005 2:06 pm    Post subject: Reply with quote

Quote:

Kolusu,

do u have any documentation on this ??


Check this link

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH10/4.3.1?DT=20010209162045

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Fri Apr 15, 2005 2:33 pm    Post subject: Reply with quote

Now what if ... Program1 one inserts into Table "A" and Program2 deletes from table "A"..

Stable state will be reached only after Program 2 completes execution.

Don't u fellas feel that .. DB2 commits only after Program 2 completes execution..

Correct me if I'm wrong !!

Tattva
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Apr 15, 2005 2:42 pm    Post subject: Reply with quote

Tattva,

You are talking about 2 different units of work. When PGM A inserts it is one unit of work. As soon as PGM A terminates successfully your inserts are commited.

ex: If PGM A inserted 100 rows and terminated successfully , and now Pgm B abends after deleting 20 rows . ONLY DELETES from PGM B are rolled back. So the table will still have the 100 inserts of PGM A

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tattva
Beginner


Joined: 02 Feb 2005
Posts: 97
Topics: 36

PostPosted: Fri Apr 15, 2005 2:43 pm    Post subject: Reply with quote

Thanks a lot for all ur responses.. !!!

Tattva
Back to top
View user's profile Send private message
mayuri
Beginner


Joined: 26 Aug 2006
Posts: 17
Topics: 4

PostPosted: Fri Mar 09, 2007 1:35 am    Post subject: Reply with quote

hi All,

I have a question regarding commit and rollback. My application queries DB2 table and fetches around 100K of rows each time. i need to take each row's data and write into a sequential file. after writing one row an update is done on one column for this row. 5000 rows are written into each file. The opening and closing of files is done dynamically.

The problem is i'm not using any COMMIT statement in the COBDB2 program. after the program runs successfully AUTOCOMMIT is issued, and if it terminates ROLBACK is done.

but now i need to change my code to issue a COMMIT after writing into each file.I'm afraid that if while writing into 3rd file (say) the program terminates. will the already commited data (10000 rows ( 2 files * 5000 each)) rollbacked?
I actually want all the updates to get Rollbacked.

Can anybody tell me whether i'm thinking in the correct way. And is there any solution for my problem.

Thanks in advance

Regards
Mayuri
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Mar 09, 2007 3:33 am    Post subject: Reply with quote

If you want to roll back committed data - do not commit it! Commit means I am happy with this is is OK to go into the table. Why do you want to rollback committed work? So you do not want to code restart processes in the event of needing to restart? If so then do not commit. Restart process is very simple - just update something somwhere after each file is committed, read on restart and skip those files.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Mar 20, 2007 9:43 am    Post subject: Reply with quote

so what happened?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
mayuri
Beginner


Joined: 26 Aug 2006
Posts: 17
Topics: 4

PostPosted: Sat Mar 24, 2007 7:15 am    Post subject: Reply with quote

I'm doing an auto commit.
Back to top
View user's profile Send private message
vini_srcna
Beginner


Joined: 17 Jul 2005
Posts: 9
Topics: 0

PostPosted: Sun Mar 25, 2007 11:41 pm    Post subject: Reply with quote

What do you mean by Auto commit in the program..?
Did you mean to say after the step1 executes, it gets commited by itself.

The bottom line is:
When the plan gets deallaocated (after step1) DB2 commits the change what ever you did. When the LOADLIB calls the plan there would be an DB2 thread establised with DB2.

If you want to link step1 & step2 in a single UOW, then there would be many ways to think about the logic.
_________________
Thanks,
Vinay Kumar,
IBM Certified DB2 UDB Database Administrator for Z/OS.
IBM Certified Application Developer for DB2 V8 Family.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group