rally
New User
Joined: 28 Jul 2005 Posts: 37
|
|
|
|
Hi,
Is there anybody can help explain how SUM working?
for example,
input file with
111aaa111 (*)
111bbb222 (**)
111ccc333 (***)
sort parmeter as following :
Code: |
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE
|
which records will be keep and write to output file?
can we specify which records we need keep?
Thanks. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If EQUALS is in effect, e.g., you specify:
then the first record for each key will be kept. In your case, that will be
111aaa111 (*)
If EQUALS is NOT in effect, then any record can be kept for each key.
DFSORT's ICETOOL gives you a lot more ways to handle duplicates. For example, the following will give you the last record with each key:
Code: |
//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(1,3,CH) LAST
/*
|
Besides LAST, you can use FIRST, FIRSTDUP, LASTDUP, NODUPS, ALLDUPS, HIGHER(x), LOWER(x), EQUAL(x).
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 |
|