my in put file is needs to be sorted on certain fields. and in the output file it should populate the last occurance (if any duplicate is there against a particular chracter set) of that record. for ex. if the in put record format is as follows:
then , 2nd requirement
(picks the latest record (on higher value of first 3 chracter set ) )
or is it
in the output file it should populate the last occurance (if any duplicate is there against a particular chracter set) of that record
not clear what you mean here as your output example shows that the record
has been dropped.
Now it is a duplicate (on 1st 3 characters) of
but it does not have a higher value as aaa equals aaa
and it fails on the 2nd alternate rule as it is the last occurrance (based on the 1st 3 characters) but has been dropped.
I am very confused , you need to give a clearer specification with examples that actually follow the specification.
the sort criteria is same as previous
sitll i am describing it : here it should first sort on 4th & 5th character and then in for multiple records these 4th & 5th character are same then it has to pick the record which has higher value for the first 3 characters.
as here in the example the record aaaaa1113333 is skipped as it is matching with aabaa1113334 for the 4th & 5th character and first 3 character (aaa) is lower then (aab).
both the things (sorting and picking one record) need to be done in one step.
hope this time it is clear.