Page 1 of 1

how to use the aggrigate function in sort

PostPosted: Tue Apr 24, 2012 5:30 pm
by muthu455
i need to use the aggregate function in sort card
this is my input file
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
000001 000051 05 VIVEK CHENNAI TAMILNADU 0012 3000
000002 000052 06 RAKEE BANGLOR KARNATAKA 0013 4000
000003 000053 07 KALAI PONDY PONDICHER 0014 5000
000004 000054 08 HARIS SALEM TAMILNADU 0015 6000
000005 000055 09 AJITH TRICH TAMILNADU 0016 7000
000006 000056 04 RAJIN GOA MAHARASTA 0017 8000
000007 000057 03 VIJAY PUNE MAHARASTA 0018 9000
000008 000058 02 VIKRA NOIDE DELHI 0019 5000

And My jcl is

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=xxxxxx.VIVEK.PS5,DISP=SHR
//SORTOUT DD DSN=xxxxxxxx.VIVEK.PS8,...
//SYSIN DD *
SUM FIELDS=(1,6,ZD)
OPTION COPY
//

i have used this jcl .. i did't have seen any change in my output
so help me how can i use the sum fields in sort field....

Re: how to use the aggrigate function in sort

PostPosted: Tue Apr 24, 2012 5:42 pm
by NicC
Why should we? You have totally ignored requests in other posts to put your data and JCL in code tags to make them more readable. If you want help you are going to have to help us make it easier to read your post.

What was the output that you got and what did you expect? And use the code tags.

Re: how to use the aggrigate function in sort

PostPosted: Tue Apr 24, 2012 5:47 pm
by BillyBoyo
You have'nt specified any "key" for the SUM to be done with.

The DFSORT manuals are on the web. Have you looked at them?

Re: how to use the aggrigate function in sort

PostPosted: Tue Apr 24, 2012 11:28 pm
by Frank Yaeger
muthu455,

You must tell use a SORT or MERGE statement to tell DFSORT which key you want to use for the SUM. DFSORT ignores SUM for a COPY operation since there's no key to look for duplicates. For example, if you want to SUM your fields for duplicate keys in positions 11-15, you would use:

   SORT FIELDS=(11,15,CH,A)
   SUM FIELDS=(1,6,ZD)


It's not obvious from your input example which fields you want to use as keys.

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