Page 1 of 1

Usage of SUM FIELDS

PostPosted: Tue Oct 09, 2007 7:52 pm
by janani
I uesd sum fields in my JCL. The JCL is executing properly,but where can i see the result of summation?

My input file is

one 12
two 13

The control statement i used for summation is:
SUM FIELDS=(5,2,zd)

Re: Usage of SUM FIELDS

PostPosted: Tue Oct 09, 2007 9:12 pm
by Frank Yaeger
SUM gives you a total for amounts in records with the same key. The SORT statement gives the key. You haven't shown your SORT statement, but let's assume it's SORT FIELDS=(1,3,CH,A). In that case, since the key in record 1 is 'one' and the key in record 2 is 'two', the keys do not match and the amounts are not summed. So your output records will look identical to your input records. If the keys in the two records matched (e.g. 'one' in both), then the amounts would be summed and you would only have one record for output. For example:

input

one 12
one 13

output

one 25

Now the question is - what are you actually trying to do? Are you trying to sum when records have the same key, or are you trying to get a total for all of the records, or what?

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/servers/storage/supp ... tmpub.html

Re: Usage of SUM FIELDS

PostPosted: Thu Oct 11, 2007 10:44 pm
by janani
Thanks frank. I have gone thru DFSORT: Beyond sorting and Getting started with DFSORT. I learnt many things