View previous topic :: View next topic
|
Author |
Message |
vinuk2009
New User
Joined: 30 Apr 2009 Posts: 19 Location: chennai
|
|
|
|
Hi,
I have a FB file and LRECL is 40. key value starts at 10 th position and ends at 17th position. I need to get the last duplicate record from this file and remove all the other records. I know the solution through ICETOOL. But I do not know by using SORT. could some one please help me on this.
Thanks,
Vinod. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, you can look at the SUM statement in the documentation.
Just in case there is nothing there*: take your sorted file to another step, where you add a sequence number, re-sort on the original key plus the sequence number, descending. Do the SUM.
If you try to do this in one step, your "last" record could vary from run to run.
*there isn't |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Just the last duplicate so if there are a million duplicates you want to ignore 999,999 duplicate records? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
this is the most puzzling kind of questions...
if something is duplicate then what difference does it make which one is being picked up
it would be better to review the definition of duplicate
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
@Enrico & Nic, I think the TS wants to eliminate duplicate key values and keep the last record of "EACH" key. (I can hear your mind voice saying "thank you captain obvious :-)" )
@vinuk2009 the requirement seems to be straight forward.
If you provide input and output records someone might be able to provide a correct solution.
Or
If you know the ICETOOL solution, post it. So we can try to convert it to a PGM=SORT. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You might try something along the lines of
Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(10,8,TRAILER3=(1,40)) |
modify the 10,8 and the 1,40 according to your needs
or
Code: |
OPTION EQUALS
SORT FIELDS=(10,8,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(10,8,TRAILER3=(1,40))
|
just run some experiments on a simple datasets |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I know the solution through ICETOOL. But I do not know by using SORT. |
If you know how to do it with DFSORT's ICETOOL (PGM=ICETOOL), then why do you need to do it with DFSORT (PGM=SORT) instead? ICETOOL is part of DFSORT - has been for many, many years. |
|
Back to top |
|
|
|