Count no of repeated records in input file



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

Count no of repeated records in input file

Postby swatmf14 » Fri Jan 17, 2014 10:16 pm

If input file contains
AAAAA
AAAAA
AAAAA
BBBBBB
BBBBBB
CCCCC
CCCCC
CCCCC
CCCCC


Then i want output as, using sort in jcl

AAAAA   3
BBBBBB  2
CCCCC  4


Please help.......
swatmf14
 
Posts: 11
Joined: Fri Jan 17, 2014 10:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count no of repeated records in input file

Postby BillyBoyo » Fri Jan 17, 2014 11:25 pm

Have you had a look at ICETOOL's COUNT operator?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Count no of repeated records in input file

Postby skolusu » Fri Jan 17, 2014 11:52 pm

BillyBoyo wrote:Have you had a look at ICETOOL's COUNT operator?


I guess you meant "OCCUR" operator instead of COUNT operator.

use the following DFSORT/ICETOOL JCL which gives the desired results

//STEP0100 EXEC PGM=ICETOOL           
//TOOLMSG  DD SYSOUT=*               
//DFSMSG   DD SYSOUT=*               
//IN       DD *                       
AAAAA                                 
AAAAA                                 
AAAAA                                 
BBBBBB                               
BBBBBB                               
CCCCC                                 
CCCCC                                 
CCCCC                                 
CCCCC                                 
//OUT      DD SYSOUT=*               
//TOOLIN   DD *                       
 OCCUR FROM(IN) LIST(OUT) BLANK -     
 HEADER('KEY') ON(1,6,CH)    -       
 HEADER('COUNT') ON(VALCNT,N05)       
//*                                   


The output is
KEY       COUNT
------   ------
AAAAA         3
BBBBBB        2
CCCCC         4
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Count no of repeated records in input file

Postby swatmf14 » Sat Jan 18, 2014 10:28 am

Can you help me by using sort utility ??

//sortin dd dsn=ip.ps,disp=shr
//sortwk dd dsn=
//sortout dd dsn=op.ps,disp=shr
//sysout dd sysout=*
//sysin dd *
  sort fields=copy
  ??????
  ??????
/*


Like this i m trying...pls help me for code in //sysin

Thnks...
swatmf14
 
Posts: 11
Joined: Fri Jan 17, 2014 10:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count no of repeated records in input file

Postby NicC » Sat Jan 18, 2014 3:03 pm

ICETOOL is part of DFsort so you have your answer.

And please use the code tags (available in the full editor if you do not know how to code them manually) when posting code, data and anything else that requires a 'screen-like' appearance or a fixed font.
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 no of repeated records in input file

Postby swatmf14 » Sat Jan 18, 2014 3:25 pm

ok..thank you...
swatmf14
 
Posts: 11
Joined: Fri Jan 17, 2014 10:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count no of repeated records in input file

Postby NicC » Mon Jan 20, 2014 4:45 am

swatfm14,
please stop posting in bold. Normal font is sufficient. Bold should be used for emphasising a point.
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 no of repeated records in input file

Postby skolusu » Tue Jan 21, 2014 12:25 am

swatmf14 wrote:Can you help me by using sort utility ??

Like this i m trying...pls help me for code in //sysin

Thnks...


You already have a working solution why do you need another solution? If you insist on having done with traditional sort, look up the Sections and trailer3 with count here

http://publibz.boulder.ibm.com/cgi-bin/ ... 1ca60/3.15
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post