View previous topic :: View next topic
|
Author |
Message |
Ramya Sundar
New User
Joined: 02 May 2007 Posts: 3 Location: Bangalore
|
|
|
|
Hi,
Iam coding a PL1 DB2 program, where I need to give a commit frequency of 5. Iam using insert in 3 tables in the program. How do I specify this? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please clarify this
Quote: |
commit frequency of 5 |
It is a term that i'm not familiar with. |
|
Back to top |
|
|
Ramya Sundar
New User
Joined: 02 May 2007 Posts: 3 Location: Bangalore
|
|
|
|
Hi.
Commit frequency of 5 implies that I need to commit after 5 rows are inserted into the table. The program is a batch program with for example 100 records input at a time. How should I check that 5 inserts are completed and give commit. Is there any way to do this?
Hope now am clarifying your question. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Usually, commits are issued at the end of a LUW (logical unit of work) rather than after n updates. This is to facilitate recovery/restart. Has your recovery/restart process been defined?
Keep in mind that any and all external updates (files, reports including counters in the reports, etc) must be syncronized.
To do what your request is, you need only to define a counter, add 1 to it as processing is done, and issue a commit when the counter reaches 5 and reset the counter after each commit. Easy to do, but may or may not be what you need n case of an abend. |
|
Back to top |
|
|
Ramya Sundar
New User
Joined: 02 May 2007 Posts: 3 Location: Bangalore
|
|
|
|
Thanks.....I will try this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
As an afterthought, why is a commit being scheduled for every 5 adds? Seems like that is very frequent |
|
Back to top |
|
|
ashwinreddy
Active User
Joined: 16 Sep 2004 Posts: 106 Location: Hyderabad
|
|
|
|
Hi,
We used to use follwoing Procedure as
As we used to use a table which contains coulmns as Program name, Commit frequency, Commit length (not sure of name) and Program keys. As normally we used to have commit frequency as 500.
And we used to check two conditions as the number of rows inserted as 500 (if so increment the commit length). And used to move the key columns to the Program keys.
And when the program abends, update the corresponding key coulmns.
And your query should be modified as (i took three coulmns Name, Emp no and DOB as keys)
Name => :Host var1
and
Emp id => :Host var2
and
DOB => :Host var3.
And before openning the cursor, we used to check the check point table whether Program name and Program keys are not spaces.
If not spaces i will move the values from the Program keys to Var1, Var2 and Var3.
Hope this will help you. But sorry if you can't i think its not easy to explain it in mail.
Cheers
Ashwin |
|
Back to top |
|
|
|