Page 1 of 1

Count Occurences

PostPosted: Mon Aug 23, 2010 5:26 pm
by mfguy
I need to find the number of times a record is present in a file.

The input file has the following records,

A1
A1
B
C2
C2

Now the output file should be of this format
A1 2
B 1
C2 2

Re: Count Occurences

PostPosted: Mon Aug 23, 2010 9:09 pm
by NicC
Look in the manual for OCCURS and VALCNT. This is from one of my reports...

OCCURS                                                     -                   
    FROM(IN)                                                -                   
    LIST(REPORT8)                                           -                   
    TITLE('XXXs present on this file')                      -                   
    BLANK                                                   -                   
    HEADER(,'XXX  ')                   ON(1,6,ZD,E'999999') -                   
    HEADER('Number of','Transactions') ON(VALCNT)

Re: Count Occurences

PostPosted: Mon Aug 23, 2010 11:26 pm
by Frank Yaeger
mfguy,

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: Count Occurences

PostPosted: Tue Aug 24, 2010 12:43 pm
by mfguy
Hi Nic and Frank thanks for ur solutions .. i got the required output using Valcnt as u suggested...