Page 1 of 1

sort on accending order and display the count.

PostPosted: Mon Sep 14, 2009 3:09 pm
by bodhi
Hello All,

I have a file with the record count of 1000000 in which i need to sort the data on the accending order and then display the record count for a particular condition. Below is the example for better understanding:

Input file:
P AAAA
P AAAA
P AAAA
P BBBB
P BBBB
P CCCC
P DDDD


Output file:
AAAA 3
BBBB 2
CCCC 1
DDDD 1

Thanks
Bodhi

Re: sort on accending order and display the count.

PostPosted: Mon Sep 14, 2009 4:12 pm
by arcvns
Bodhi,

display the record count for a particular condition
What's your condition here? It seems like u r counting all occurrences of field-2.

Re: sort on accending order and display the count.

PostPosted: Mon Sep 14, 2009 4:29 pm
by bodhi
Yes, I am counting all the occurrences of the field-2.

Bodhi

Re: sort on accending order and display the count.

PostPosted: Tue Sep 15, 2009 8:18 pm
by lal
Hi Bodhi,
Following JCL should help you...

//SORTIN   DD *                                                     
P AAAA                                                             
P AAAA                                                             
P AAAA                                                             
P BBBB                                                             
P BBBB                                                             
P CCCC                                                             
P DDDD                                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  SORT FIELDS=(3,4,CH,A)                                           
  OUTFIL REMOVECC,NODETAIL,                                         
  SECTIONS=(3,4,TRAILER3=(3,4,5X,COUNT))                           
//*     


Thanks,
lal

Re: sort on accending order and display the count.

PostPosted: Wed Sep 16, 2009 5:55 pm
by bodhi
Thank you Lal it is working fine for me.

Bodhi