How to do SELECTIVE COMMIT in a COBOL DB2 program?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Om Shah
New Member
Posts: 5
Joined: Sun Aug 03, 2014 8:20 pm

How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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.
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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?
Om Shah
New Member
Posts: 5
Joined: Sun Aug 03, 2014 8:20 pm

Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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.
Regards
Nic
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: How to do SELECTIVE COMMIT in a COBOL DB2 program?

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”