Page 1 of 1
How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Mon Jan 18, 2016 11:00 am
by Om Shah
Hi,
I have a COBOL DB2 program that updates many DB2 tables in it. However, I was thinking to COMMIT only some of the tables and not all. If I issue a COMMIT it'll update all the tables but I want to commit only a some DB2 tables. Is it possible to do such selective commit in a COBOL DB2 program?
Please guide with some thoughts or documents.
Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Mon Jan 18, 2016 12:43 pm
by enrico-sorichetti
Is it possible to do such selective commit in a COBOL DB2 program?
NO.
and anyway,
why would You want to do something contrary to proper data integrity Logic?
Just forget about it.
Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Mon Jan 18, 2016 4:40 pm
by William Collins
Why would you want to do that? enrico has alluded to the dangers. What are you hoping would happen if you were only able to commit little bits and pieces?
Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Tue Feb 09, 2016 12:10 pm
by Om Shah
For a financial calculation I need some input from the input file. Based the today's input the base rate in the table will be updated and now that rate should be taken for the final calculation. That is why I thought to have an intermediate commit for some tables which has got the base rate.
Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Tue Feb 09, 2016 2:35 pm
by nicc
That is bad design. You need two programs. one to update the tables and one to use the updated tables. Alternatively you design restart logic so that if the table has alredy been updated then you do not update it again - unless such an update is simply replacing the current values.
Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?
Posted: Tue Feb 09, 2016 4:27 pm
by Anuj Dhawan
Yes, you should rethink about the design approach. On the other hand, if these program were designed long back and you find yourself in the middle of the mud - one possible way out is, update the tables you think you should COMMIT; store the other information in some temporary area of your program, and issue a COMMIT.
Don't forget to implement a check-point restart logic, as nicc has also said.