View previous topic :: View next topic
|
Author |
Message |
rz061m
New User
Joined: 03 Mar 2006 Posts: 48 Location: Chennai
|
|
|
|
Hi,
I have File1 & File2, see below for sample records.
If File1 contains the record as (80 10 _ _), _ for spaces, then all the records starting with 80 10 has to be excluded from File2 and the remainig records need to be written to the output file.
Same applies to all the remaning records in the File1.
See below for sample records in File1 & File2
File1: Exclusion file
80 10 _ _
80 20 _ _
90 20 _ _
100 10 20 _
110 20 30 40
_ for spaces
File2: Claims File
80 01 20 30
80 10 20 30
80 20 22 30
81 21 22 23
90 10 10 30
90 20 10 30
100 10 20 20
100 10 20 30
110 20 30 40
110 30 40 50
Output file:
81 21 22 23
90 10 10 30
110 30 40 50
Thanks,
RZ061M |
|
Back to top |
|
|
rz061m
New User
Joined: 03 Mar 2006 Posts: 48 Location: Chennai
|
|
|
|
Hi,
The output file will contain four record in it aganist the three posted earlier......
Please note that these 2 files are Sequential files.
Output file:
80 01 20 30
81 21 22 23
90 10 10 30
110 30 40 50
thanks,
Karthik. P |
|
Back to top |
|
|
Raphael Bacay
New User
Joined: 04 May 2007 Posts: 58 Location: Manila, Philippines
|
|
|
|
You can try the following method:
Sort both files.
read file1
read file2
perform until end of file1 or file2
case record1 = record2
read file1
read file2
case record2 < record1
write record2
read file2
case record1 < record2
read file1
end-perform
You can probably use the whole record for comparison instead of a key.
I hope it works... |
|
Back to top |
|
|
Raphael Bacay
New User
Joined: 04 May 2007 Posts: 58 Location: Manila, Philippines
|
|
|
|
I have addenum...
You can try the following method:
Sort both files.
read file1
read file2
perform until end of file2
case record1 = record2
read file1
read file2
case record2 < record1
write record2
read file2
case record1 < record2
read file1
case end of file1
write remaining records to output file
end-perform |
|
Back to top |
|
|
|