Page 1 of 1

Get unique values and the respective count..

PostPosted: Fri Oct 26, 2012 5:19 pm
by manojul22
Requirement
I need to get the unique values and the respective counts.
Sample Input
|abc|^qwef|^asdr|^zxc|^
|^abc|^zxc|
|abc|^qwef|^asdr|^zxc|^
|^abc|^zxc|^abc|^zxc
Expected output
abc 5
qwef 2
asdr 2
zxc 5
I have 1.4 million records which is the unload of one specific field(var char) from a DB2 table.
The record can have n number of values(like abc, qwef etc) the length is also not fixed.

Please suggest.

Re: Get unique values and the respective count..

PostPosted: Fri Oct 26, 2012 5:51 pm
by BillyBoyo
What do the "carats" indicate?

Re: Get unique values and the respective count..

PostPosted: Fri Oct 26, 2012 5:58 pm
by manojul22
New line feed in mainframe

Re: Get unique values and the respective count..

PostPosted: Fri Oct 26, 2012 7:31 pm
by BillyBoyo
You mean NL or you mean LF? So you have strings of different lengths, some with a byte with a non-display value leading or trailing, some fields solely with the non-display. And you want counts of each different, ignoring any of the non-display characters present - and the fields are delimited by the pipe, your file is VB. Is there a maximum number of fields on a record? What is the LRECL? Maximum lenght of a field? Do you want the "empty" fields counted?