Page 1 of 1

Sort Functionality

PostPosted: Tue Jul 14, 2009 4:25 pm
by Devarati
Hi,

I have a query on SORT in JCL. This goes as below:

I have on I/P file whach have some records and can have unique entries as well as duplicates. I want to sort the file to get two O/P files - one will have the unique entries and the other will have the duplicate entries. How do I do that using SORT utility in JCL? Can it be done in one step of SORT? Please help....

I give an example for that:

I/P File:
----------

a
a
b
c
d
d
e
f
f

O/P File (unique entries):
-----------------------------
b
c
e

O/P File (duplicate entries):
---------------------------------
a
a
d
d
f
f

How do I do that??????

Thanks in advance,
Devarati

Re: Sort Functionality

PostPosted: Tue Jul 14, 2009 8:12 pm
by Frank Yaeger
Here's a DFSORT/ICETOOL job that will do what you asked for:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT1 DD DSM=...  output file1
//OUT2 DD DSM=...  output file2
//TOOLIN DD *
SELECT FROM(IN) TO(OUT1) DISCARD(OUT2) ON(1,1,CH) NODUPS
/*


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