Count Occurences



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Count Occurences

Postby mfguy » Mon Aug 23, 2010 5:26 pm

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
mfguy
 
Posts: 7
Joined: Mon Aug 23, 2010 5:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count Occurences

Postby NicC » Mon Aug 23, 2010 9:09 pm

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)
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Count Occurences

Postby Frank Yaeger » Mon Aug 23, 2010 11:26 pm

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: Count Occurences

Postby mfguy » Tue Aug 24, 2010 12:43 pm

Hi Nic and Frank thanks for ur solutions .. i got the required output using Valcnt as u suggested...
mfguy
 
Posts: 7
Joined: Mon Aug 23, 2010 5:20 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post