View previous topic :: View next topic
|
Author |
Message |
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
Hi,
I have the following requirement
File 1
Key Value
42 9876
43 7654
44 5432
File 2
Key Value
42 9876
43 7654
44 5432
The output file should be
42 9876 7654
42 9876 5432
43 7654 9876
43 7654 5432
44 5432 9876
44 5432 7654
Currently I am using the matched function of Easytrieve which doesnot help me to get the above result.
I get the result as
42 9876 7654
43 7654 9876
If anybody knows the solution please help me out |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
How do you get "Retrieving matched duplicate records" out of this:
42 9876 7654
42 9876 5432
43 7654 9876
43 7654 5432
44 5432 9876
44 5432 7654
?
Define the rules for your "match". |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
Sorry the desceiption above is wrong
File1
Key Value
42 9876
42 7654
42 5432
File2
Key Value
42 9876
42 7654
42 5432
Output expected
42 9876 7654
42 9876 5432
42 7654 9876
42 7654 5432
42 5432 9876
42 5432 7654
Sorry for the mistake |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
William Thompson wrote: |
How do you get "Retrieving matched duplicate records" out of this:
42 9876 7654
42 9876 5432
42 7654 9876
42 7654 5432
42 5432 9876
42 5432 7654
?
Define the rules (using words and sentences) for your "match". |
|
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
If the key in file1 matches with the one or more records in file2 then display the key of file1 with the combination of value in file2
ie if file1 has a key 42 and value 10
file 2 has 2 records with key 42 but different values. then we need to display
file1_key(42) file1_value(10) file2_value
file1_key(42) file1_value(10) file2_value
Does this explain.... |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Not being much of an EZT person - though it does have some nice key matching capabilities - I can't see how to do this without have the file inputting twice at the same time - or the original and a copy.
Keying off the first, read a record, scan the second for key matches, ignore if value equal and write if key equal and number not.
When the second file at ends (or key break if sorted) close and open the second file and repeat. |
|
Back to top |
|
|
Huzefa
New User
Joined: 05 Dec 2006 Posts: 83 Location: Bangalore
|
|
|
|
I tried closing the file and re-opening it but that didn't work
Could you put a small code snippet of how u would do it where it is a PS file. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
You got to realize that there is no open/close in EZT and ps files can't be repositioned.
Like I said before, you have to approach this from a different direction. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Both this and the other post sound right up the alley for a DFSORT process for record matching, providing that Huzefa has DFSORT available. |
|
Back to top |
|
|
|