View previous topic :: View next topic
|
Author |
Message |
krunalbafna Warnings : 1 Active User
Joined: 18 Jan 2010 Posts: 143 Location: Pune
|
|
|
|
Hi,
Following is the dilemma i am facing:
I have my cobol db2 code:
Following is the step followed:
1. Read the VB - PS file
2. Based on the condition update the table and if update successful copy the record into output file for 20 times.
3. Above procedure should repeat for 20 times
4. If suppose number of records are less than 20 we need to rollback all the changes in the table.
My dilemma,
is there any procedure for step2, above.
if i define 2 output files.
File-1 will have records for every successful update.
if update count=20 can i copy those records into file-2,emptying file-1
else
if update<20 just empty the records from file-1.
If you provide your kind feedback it will be great |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hello Krunal,
I have a Question here. Why can you delete unwanted record from your input file in ur case record which have occurance less than 20 And then updated DB2 TABLE from newly createed file which will have all valid records.
Hope i have nt misunderstood the requirement. |
|
Back to top |
|
|
krunalbafna Warnings : 1 Active User
Joined: 18 Jan 2010 Posts: 143 Location: Pune
|
|
|
|
HI,
I am not deleting anything from input file.
My input file is having 50lacs records.
I cannot chk for each occurance.
What my programs wants if read records from file for particular occurances,update the tally table.
Repeat for twenty times.
If it successfully happens write those 20 records to output file..
So i had an idea of copying records from output file-1 to file-2
if upd-cnt = 20 than copy records from file-1 to file-2
else empty file-1 for next occurances |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hello Krunal,
Its bit confusing. Do you have 20 records for each valid key yes or no?
Can you provide one sample input file ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Ekta,
TS has posted this multiple times with slightly different wording. . .
It appears that some solution has already been chosen and the forum topics are an attempt to get the solution to be usable (rather than creating a different solution that would be easy t implement).
As you suggest, "queueing" the records and then writing the output only when appropriate would be a very good solution (IMHO)
d |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
TS has posted this multiple times with slightly different wording. . . |
and every time has added confusion ! |
|
Back to top |
|
|
|