Page 1 of 1

Count no of repeated records in input file

PostPosted: Fri Jan 17, 2014 10:16 pm
by swatmf14
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.......

Re: Count no of repeated records in input file

PostPosted: Fri Jan 17, 2014 11:25 pm
by BillyBoyo
Have you had a look at ICETOOL's COUNT operator?

Re: Count no of repeated records in input file

PostPosted: Fri Jan 17, 2014 11:52 pm
by skolusu
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

Re: Count no of repeated records in input file

PostPosted: Sat Jan 18, 2014 10:28 am
by swatmf14
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...

Re: Count no of repeated records in input file

PostPosted: Sat Jan 18, 2014 3:03 pm
by NicC
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.

Re: Count no of repeated records in input file

PostPosted: Sat Jan 18, 2014 3:25 pm
by swatmf14
ok..thank you...

Re: Count no of repeated records in input file

PostPosted: Mon Jan 20, 2014 4:45 am
by NicC
swatfm14,
please stop posting in bold. Normal font is sufficient. Bold should be used for emphasising a point.

Re: Count no of repeated records in input file

PostPosted: Tue Jan 21, 2014 12:25 am
by skolusu
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