View previous topic :: View next topic
|
Author |
Message |
Smita Sebastian
New User
Joined: 30 May 2007 Posts: 7 Location: India
|
|
|
|
Hi,
I have a requirement where the input file may have duplicate records. The file should be sorted such that if duplicates are present, then only the first occurrence/record is written to the output. For records with no duplicates, they also should be written to the same output.
Input -
AAAAA
BBBBB
CCCCC
AAAAA
CCCCC
DDDDD
OUTPUT expected-
AAAAA
BBBBB
CCCCC
DDDDD
I searched a sloution for this in the previous posts, but did not find one. Please help..
Thanks! |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
You can use ICETOOL SELECT operator
Code: |
//DOIT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INP DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(INP) TO(OUT) ON(1,5,CH) FIRST
/*
|
Input:
Code: |
AAAAA
BBBBB
CCCCC
AAAAA
CCCCC
DDDDD
|
Output:
Code: |
AAAAA
BBBBB
CCCCC
DDDDD
|
|
|
Back to top |
|
|
Raphael Bacay
New User
Joined: 04 May 2007 Posts: 58 Location: Manila, Philippines
|
|
|
|
Code: |
//STEP10 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...,DISP=SHR
//SORTOUT DD DSN=...
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=NONE
/*
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Smita,
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
Smita Sebastian
New User
Joined: 30 May 2007 Posts: 7 Location: India
|
|
|
|
Hi.
Thanks Aaru. That worked!
Frank, the IBM link that you send is very useful. Thankyou. |
|
Back to top |
|
|
|