sort unique records



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

sort unique records

Postby shankarhosur » Fri Nov 12, 2010 1:52 am

My input file is something like below,

334219 40878002733100420100723A00000046218MOR
334219 42947178433100420100723A00000071316GOR
444219 42947178433100420100723F00000035658GOR
444219 43331199733100420100723A00000027897GOR
555219 47572143533100420100723A00000066664GOR
555219 21472494133100620100723A00000002760GOR

First 6 byte is plan number. I want to filter only unique records based on plan number. The output would be something like,

334219 42947178433100420100723A00000071316GOR
444219 42947178433100420100723F00000035658GOR
555219 47572143533100420100723A00000066664GOR

Is it possible using SORT?
shankarhosur
 
Posts: 10
Joined: Sat Oct 16, 2010 6:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: sort unique records

 

Re: sort unique records

Postby Frank Yaeger » Fri Nov 12, 2010 5:51 am

Your example does not show filtering by "unique" records. It shows keeping one record with each key. If you want to keep the first record with each key, you can use a DFSORT/ICETOOL job like this:

//S1    EXEC  PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN DD *                                                 
334219  40878002733100420100723A00000046218MOR             
334219  42947178433100420100723A00000071316GOR             
444219  42947178433100420100723F00000035658GOR             
444219  43331199733100420100723A00000027897GOR             
555219  47572143533100420100723A00000066664GOR             
555219  21472494133100620100723A00000002760GOR             
//OUT DD SYSOUT=*                                         
//TOOLIN   DD   *                                         
SELECT FROM(IN) TO(OUT) ON(1,6,CH) FIRST                   
/*                                                         


If you want to do something else, you need to do a better job of explaining exactly what it is you want to do.

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:

http://www.ibm.com/support/docview.wss? ... g3T7000080
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: sort unique records

Postby shankarhosur » Fri Nov 12, 2010 6:24 am

How to catch the rest of the records in different file means skipped records.
shankarhosur
 
Posts: 10
Joined: Sat Oct 16, 2010 6:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: sort unique records

Postby shankarhosur » Fri Nov 12, 2010 6:40 am

I got it..!!

//S1    EXEC  PGM=ICETOOL                     
//TOOLMSG DD SYSOUT=*                         
//DFSMSG  DD SYSOUT=*                         
//IN DD *                                     
334219  40878002733100420100723A00000046218MOR
334219  42947178433100420100723A00000071316GOR
334219  42947178433100420100723A00000071316GOR
334219  42947178433100420100723A00000071316GOR
444219  42947178433100420100723F00000035658GOR
444219  43331199733100420100723A00000027897GOR
555219  47572143533100420100723A00000066664GOR
555219  21472494133100620100723A00000002760GOR
//OUT1 DD SYSOUT=*                             
//OUT2 DD SYSOUT=*                             
//TOOLIN   DD   *                             
SELECT FROM(IN) TO(OUT1) ON(1,6,CH) FIRST -   
DISCARD(OUT2)                                 
/*
shankarhosur
 
Posts: 10
Joined: Sat Oct 16, 2010 6:10 am
Has thanked: 0 time
Been thanked: 0 time

Re: sort unique records

Postby dick scherrer » Fri Nov 12, 2010 6:57 am

Good to hear it is working - congrats :)

Thank you for posting your solution,

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post