View previous topic :: View next topic
|
Author |
Message |
ppandey07
New User
Joined: 27 Nov 2008 Posts: 51 Location: Delhi, India
|
|
|
|
Hi there,
I have two files of same LRECL and have same data.
I want to sort these files via four fields and want to remove duplicates only via those four fields.
Now there is one more field in the files(different than sorted fields),
and on the basis of this field, I want to remove duplicates.
Can you please help me with that? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you want to remove duplicates, you'll need to sort on the fifth field as well, else how is anything to know about all the duplicates?
Then, what is wrong with SUM FIELDS=NONE?
If that isn't going to work for you, you'll have to explain it better, with examples of the input and the expected output for that input.
It is irrelevant if there are two files and you are going to sort them together, it is one file by the time the sort sees it. |
|
Back to top |
|
|
ppandey07
New User
Joined: 27 Nov 2008 Posts: 51 Location: Delhi, India
|
|
|
|
Bill Woodger wrote: |
If you want to remove duplicates, you'll need to sort on the fifth field as well, else how is anything to know about all the duplicates?
Then, what is wrong with SUM FIELDS=NONE?
If that isn't going to work for you, you'll have to explain it better, with examples of the input and the expected output for that input.
It is irrelevant if there are two files and you are going to sort them together, it is one file by the time the sort sees it. |
Fifth field has a different constant value in each file. Let’s say first file has value A and second has value B in fifth field. And If the concatenation of these two files causes any duplicate record (on the basis of first four field) then I want to remove duplicate and want
To keep record from first file only(with value A).
Please let me know if more information is required. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
So, OPTION EQUALS, sort on four fields. SUM FIELDS=(NONE)
Try it. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
as long as the concatenation of files in SORTIN is file with 'A' first. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Worth pointing out. Pankaj, don't just "say" it, make it so, else you'll get the wrong ones.
EDIT: That means document it that way as well, so someone "cleverer" than you doesn't "correct" the order of the files because it is somehow neater, or something dumb like that. |
|
Back to top |
|
|
|