Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SORT sub-option sum usage

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rally

New User


Joined: 28 Jul 2005
Posts: 37

PostPosted: Mon Nov 14, 2005 8:12 pm    Post subject: SORT sub-option sum usage
Reply with quote

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.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Nov 14, 2005 10:25 pm    Post subject:
Reply with quote

If EQUALS is in effect, e.g., you specify:

Code:

   OPTION EQUALS


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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 5 Sat Aug 19, 2017 2:33 pm
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us