Page 1 of 1

Icetool count indexes

PostPosted: Tue Jan 24, 2012 8:55 pm
by Florian Sorg
Hi,
excuse me if my english isn't very well, i'm from germany ;-)

I've a question about the count funktion of DFSORT/ICETOOl

for example i have a table:

a | 5 | 7
b | 7 | 3
c | 3 | 6

and i want to count vertically that it locks like:

all | 15 | 16

is this possible?

Thanks for answering
Flo

Re: Icetool count indexes

PostPosted: Tue Jan 24, 2012 9:12 pm
by BillyBoyo
Yes, it is possible.

If you can give some thought to whether this is a complete description of what you want, like you want only one line on a report? One record in a file? Last line of a report? Final record on a file, etc?

Describe it as best you can, and then when you wake up tommorow you'll probably have an enlightening and extremely pleasant surprise.

Re: Icetool count indexes

PostPosted: Tue Jan 24, 2012 9:59 pm
by Florian Sorg
ok the numbers in the table are indexes and i have to count vertically and write a line unter the table
e.g:
input:
a |5 | 7
b |7 | 3
c |3 | 6

output:
a |5 | 7
b |7 | 3
c |3 | 6
all |15|16

i had tried it like this:
//TOOLIN DD *
SORT FROM(DATA) TO(DATA2) USING(CNT1)
/*
//CNT1CNTL DD *
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(6,2,ZD,9,2,ZD)
/*
But it doesn't work :-(

thanks a lot

Re: Icetool count indexes

PostPosted: Tue Jan 24, 2012 11:47 pm
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT                                         
//SYSOUT DD SYSOUT=*                                       
//SORTIN DD *                                               
a   |5 | 7                                                 
b   |7 | 3                                                 
c   |3 | 6                                                 
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
  OPTION COPY                                               
  OUTFIL REMOVECC,                                         
    TRAILER1=('all |',TOT=(6,2,UFF,M10,LENGTH=2),'|',       
     TOT=(9,2,UFF,M10,LENGTH=2))                           
/*


Note that we use the TOT function for the totals, not the COUNT function.

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

Re: Icetool count indexes

PostPosted: Wed Jan 25, 2012 2:37 pm
by Florian Sorg
the code is working,
thanks for the quick answering thats realy great