View previous topic :: View next topic
|
Author |
Message |
Indrajit_57 Warnings : 1 New User
Joined: 27 Jun 2006 Posts: 60
|
|
|
|
Hi,
I need to find records from 2 files if certain fields in both the file changes and then output the entire record from the first file.
For example,
Two Files F1 and F2 both are FB/10000 bytes. Both the files are sorted and the key is from 1 to 22 bytes in both the files. Both the files may have duplicate keys.
The number of fields (trigger fields) to match in both these files are around 150 (all of which are not in continuous offset position and also varies in length and format). In this example we can consider to match 5 fields having offset location as: -
Start - 1, Length 22, CH - This is the key
Start - 30, Length 3, ZD
Start - 50, Length 9, PD
Start - 65, Length 1, CH
Start - 70, Length 5, ZD.
If there are any extra records in File 1, then it needs to be reported.
Currently I am doing this using 4 steps: -
Step 1 - Extract only the trigger fields from File 1
Step 2 - Extract only the trigger fields from File 2
Step 3 - Find unmatched records between the output of Step 1 and Step 2
Step 4 - Do a JOINKEYS on File 1 and the output from Step 3
Is there a better way of achieving this. In the final output file, I also need to have header record with Format as 'H' followed by the date (which is present in the header record of File 1. The header record in file 1 is identified by having all 0 in the key). The final output file also should have a trailer record with format as 'T' followed by the total count of records in the output (excluding the Header and Trailer records).
Thanks,
Indrajit |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Indrajit,
Your explanation is pathetic also for person being in forum quite some time
Quote: |
Step 1 - Extract only the trigger fields from File 1
Step 2 - Extract only the trigger fields from File 2
Step3 - Find unmatched records between the output of Step 1 and Step 2
Step 4 - Do a JOINKEYS on File 1 and the output from Step 3
|
Why is step 4 needed?
Also explain why is step4 needed?
And it is always easier to articulate wht is needed when you show us sample input and output |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What are you doing/going to do if your duplicate keys (assuming you mean for the entire match key) have different data values for any of the other 150 pieces of data? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Show some input data and what you want for output when that sample data is processed. Be comprehensive. |
|
Back to top |
|
|
|