View previous topic :: View next topic |
Author |
Message |
tattva Beginner
Joined: 02 Feb 2005 Posts: 97 Topics: 36
|
Posted: Fri Apr 15, 2005 1:31 pm Post subject: DB2 COMMIT |
|
|
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 |
|
|
NASCAR9 Intermediate
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
|
Posted: Fri Apr 15, 2005 1:40 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Apr 15, 2005 2:03 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
tattva Beginner
Joined: 02 Feb 2005 Posts: 97 Topics: 36
|
Posted: Fri Apr 15, 2005 2:33 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Apr 15, 2005 2:42 pm Post subject: |
|
|
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 |
|
|
tattva Beginner
Joined: 02 Feb 2005 Posts: 97 Topics: 36
|
Posted: Fri Apr 15, 2005 2:43 pm Post subject: |
|
|
Thanks a lot for all ur responses.. !!!
Tattva |
|
Back to top |
|
|
mayuri Beginner
Joined: 26 Aug 2006 Posts: 17 Topics: 4
|
Posted: Fri Mar 09, 2007 1:35 am Post subject: |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 09, 2007 3:33 am Post subject: |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Tue Mar 20, 2007 9:43 am Post subject: |
|
|
so what happened? _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
mayuri Beginner
Joined: 26 Aug 2006 Posts: 17 Topics: 4
|
Posted: Sat Mar 24, 2007 7:15 am Post subject: |
|
|
I'm doing an auto commit. |
|
Back to top |
|
|
vini_srcna Beginner
Joined: 17 Jul 2005 Posts: 9 Topics: 0
|
Posted: Sun Mar 25, 2007 11:41 pm Post subject: |
|
|
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 |
|
|
|
|