View previous topic :: View next topic
|
Author |
Message |
Rohan saldanha
New User
Joined: 23 Apr 2010 Posts: 3 Location: Alabama
|
|
|
|
I need to exclude duplicate records from a file based on a key. The entire set of duplicate records should be excluded. I do not want to retain even one record of the duplicated set.
Example of input file records with first byte as key:
1 John
1 Henry
2 Jane
1 Kyle
3 Doris
3 Kelley
5 Samantha
The output file should contain:
2 Jane
5 Samantha
Thanks,
Ivan |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have a look at ICETOOL's SELECT operator. |
|
Back to top |
|
|
Rohan saldanha
New User
Joined: 23 Apr 2010 Posts: 3 Location: Alabama
|
|
|
|
There are three records with '1' as the key which should be excluded
There are two records with '3' as the key which should be exclude.
The records with '2' and '5' as keys do not have duplicates and should be included.
I think I have provided an example which accurately depicts what I need.
Typical requirements would want unique records to be retained in the file. I do not want the entire set of duplicated records.
I am not sure how to accomplish this using the 'select' statement in ICETOOL. Any help would be appreciated.
Thanks. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You look at Chapter 7 in the Application Programming Guide. You then find (they are in alphabetical order) the documentation for SELECT and read about the options, any of which may be useful to you in the future.
NODUPS does exactly what you want.
So a simple SELECT, pretty much Example 2 at the end of the description of SELECT, with a different key position and type.
You'll learn nothing if I just paste the example, or you do. So put the effort in to read about SELECT, and maybe a couple of other operators at the same time. That's the way I do it. |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Try this and let us know the results.
Code: |
//CPYJK EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
1 John
1 Henry
2 Jane
1 Kyle
3 Doris
3 Kelley
5 Samantha
//OUT2 DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN1) TO(OUT2) ON(1,1,CH) NODUPS
|
|
|
Back to top |
|
|
Rohan saldanha
New User
Joined: 23 Apr 2010 Posts: 3 Location: Alabama
|
|
|
|
Thanks a lot Bill and Magesh for your assistance. That did work. Did not realize it was that simple..ofcourse after someone tells you.
I have used other more involved options in icetool for other situations but never thought it would be so straight forward for the my current need.
Thanks again for your time. |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
Somewhere, Frank Yeager is trying not to shed a little tear of joy that DFSORT has another convert. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Quote: |
Somewhere, Frank Yeager is trying not to shed a little tear of joy that DFSORT has another convert.
|
And a lot of tears when the TS moves to a Syncsort site? |
|
Back to top |
|
|
|