i have a requirement to compare consecutive records of a file, using a key and write the output file when the records don't match. For example, the file below has 5 fields - with the 1st, 2nd and 3rd fields forming the 'key'
UID FNAME LNAME MNAME
----------------------------------------
12345678910 BBBBBB CCCCC DDDDDD
12345678910 BBBBBB CCCCC DDDDDD
12345678910 BBBBBB CCCCC DDDDDD
12345678911 XXXXXX JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678912 XYZXXX JJTIJJ DDDDDD
----------------------------------------
12345678910 BBBBBB CCCCC DDDDDD
12345678910 BBBBBB CCCCC DDDDDD
12345678910 BBBBBB CCCCC DDDDDD
12345678911 XXXXXX JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678912 XYZXXX JJTIJJ DDDDDD
UID - UNique ID ( 1, 11 )
FNAME - first name ( 20,20 )
LNAME - last name ( 50,40 )
MNAME - middle name ( 120,20 )
If we look at the first three records - for the UID 12345678910, same FNAME and LNAME values exist. I don't want to write any of such records
the next one - 12345678911 has FNAMEs XXXXXX, AAAAAA in the records 4th,5th records respectively and the 6th record has FNAME and LNAME
values repeating. So, we need to capture only the 4th and 5th records for 12345678911.
To summarize, any change in the FNAME + LNAME combination in consecutive records for a particular UID should be written to the output file.
Desired output
---------------
UID FNAME LNAME MNAME
-------------------------------------------------
12345678911 XXXXXX JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678912 XYZXXX JJTIJJ DDDDDD
-------------------------------------------------
12345678911 XXXXXX JJJJJJ DDDDDD
12345678911 AAAAAA JJJJJJ DDDDDD
12345678912 XYZXXX JJTIJJ DDDDDD
I'm a novice as far as ezytrieve is concerned and tried acheiving this result thru SORT but it took about 10 steps to achieve it.
I was told that ezytrive can crack this in a much better way with simpler and smaller no of steps.
please advice. Thanks for your assistance in advance.