View previous topic :: View next topic
|
Author |
Message |
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Hi,
Please help me out
I want to write two file match program but may be dupilcate in both input file Please suggest any idia or sample cobol program |
|
Back to top |
|
|
a027412
New User
Joined: 05 Jul 2007 Posts: 40 Location: Minneapolis, MN
|
|
|
|
Hi,
this can also be done in EZTRIEVE (with very LOC). Please let me know if you need sample code. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks for the information
I want write only cobol program |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
vicky10001,
Why don't you remove duplicates of both the files using sort JCL and pass those files to your COBOL program. This way you don't have to handle duplicates in either of the files.
--Parag |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Hi,
We need to process dupicates record after that we have to some manipuation. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
hi we can do this by using ezyrtrive programme
in this program(jcl)
step1-sort the both input files in one order
stet2 --use this ezyretrive program
here this programmes gives two output files
ouptput1: contains the match records
output2:contains contains the unmatch recods |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks for the information
I want do only duplicate records and should be cobol program
example
file1
101
101
102
103
103
file2
101
101
101
102
103
104
104
finaly i should take file 1 and file2 same claim and its matching claim fil1 and file2 I need to amt calcuation even duplicaties also
Q)
How do matching and calculation
Please give me any sample program |
|
Back to top |
|
|
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
Hi Vicky,
Please clarify.. Is the File1 main file and File2 used as a lookup.
If so, I think you can use this simple logic.
Read a record in file1.
Read a record in file2.
Do the following until e-o-file1.
{
=>If file1-key = file2-key
Do the calculation & write out.
Read file-1 until diff key is fetched and write out each record with
the same calculated value.
==>else if file1-key < file2-key
no matching file2-record found so, no calculation, write out.
Read file1-key
==>else
Read file2-key.
}
Sorry if it didnt help. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Vicky,
Please post what the output should be from your input.
Also, please explain how the duplicates are to be resolved between files. For example, if there are 7 entries in file1 and 5 in file2 for the same "key" which are considered "matched" and which are "unmatched"? |
|
Back to top |
|
|
nagasri83
New User
Joined: 20 May 2005 Posts: 15 Location: chennai
|
|
|
|
Quote: |
example
file1
101
101
102
103
103
file2
101
101
101
102
103
104
104
finaly i should take file 1 and file2 same claim and its matching claim fil1 and file2 I need to amt calcuation even duplicaties also
Q)
How do matching and calculation
|
This is not clear, can you explain this a bit more clear so that I can help u? |
|
Back to top |
|
|
sasikumar1984
Active User
Joined: 02 Jul 2007 Posts: 109 Location: Chennai - India
|
|
|
|
Hi Vicky,
follow these steps..
1. first sort both the file with Num. ex: 101,102,103 etc.
2. get record from file-1, check whether this num is available in file-2, then move that calculated-amt and the number to local variables.
3. then read second record in file-1, compare the number with previous number which u moved to local variable, if it same then check this number in file-2, if available then add the calculated-amt = calculated -amt + current-recor-calculated amt... do this until ur check for number is not equal to current-record-number in file-1. then move the values...
its easy only yaa,,,, even i was looking for matching program, but mine is big requirement... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
There is a 2-file match/merge example program posted in this cobol section. It is the "sticky" near the top of the topic list. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Thanks all
File1
100
100
101
101
102
File2
100
100
100
101
102
103
103
Matched output
100
101
102
but before write o/p need to calculate amt field in file1 and calculate amt field in file2 then need to validate after only need to move match file
I thinking that need to do
1.read file1
2. read file2
3. record match then need to move cobol table file1 records and file2 records also need to move table2 and check next file1 records that is also match need to move table 1 and like table 2.
Could Please provide some example cobol program .
Please check my requirement and Please suggest some idea also |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Vicky,
Read my previous reply - it tells you where to obtain such a sample. . . . |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
Dick scherrer,
I have searched Topic. I can't found out with duplicate two-file match.
I need to do process only duplicate only.
In duplicate record How to do Two-file match |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Vicky,
If you start on the main page of the forum, click on Mainframe COBOL, and look at the topics listed, there is a "Sticky" near the top of the list.
If you then click on that Sitcky, it has a small 2-file match program attached as a text file. That code (probably with minor modification) will do what you want.
Download that example, put it on your system, and make the changes as required by your requirement - the main changes needed will be for your record format(s) and any logic specific to your data.
Once you have done this, post back here if you have any questions. |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
|
|
d.sch,
Thanks for the informaion |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome
We're here if there are questions. |
|
Back to top |
|
|
|