Page 1 of 1

how to delete the same records during sorting

PostPosted: Wed Jun 10, 2009 10:18 am
by lxw039
Hi,my friends

I use JCL read a dataset and sort by bn. get the records lis, each record have following fields:
bn
address
name
....

if bn is the same in following reading, we will skip the record. my means just keep unique bn record, don't repeat record that bn is the same. do you have some good idea? I'm very appreciate if yu have sample code for that.

thank you very much!

Re: how to delete the same records during sorting

PostPosted: Wed Jun 10, 2009 8:57 pm
by Bill Dennis
To drop duplicate bn when you sort, add

 
   SUM FIELDS=NONE

Re: how to delete the same records during sorting

PostPosted: Fri Jul 10, 2009 12:04 am
by Irene Ioujanina
Hello. I migth not inderstand the problem corectly, but if you don't have the key value in every record, the following post from Feb 17, 2009 12:28 pm will expalin how to eliminate duplicate records:

"Delete duplicate headers and keep group records"
by Irene Ioujanina » Tue Feb 17, 2009 12:28 pm

Hope it helps :)

Re: how to delete the same records during sorting

PostPosted: Fri Jul 10, 2009 1:11 am
by Frank Yaeger
You can do that kind of thing easily with an ICETOOL job like this:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(p,m,f) FIRST
/*


where p,m,f is the starting position, length and format of the bn (the key). For example, if bn is a character field in positions 1-5, you would use ON(1,5,CH).

If that doesn't help, then be more specific about what you want to do and show an example of input records and expected output records.

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