Page 1 of 1

Printing duplicates if they are greater than x

PostPosted: Thu Jun 18, 2015 5:15 pm
by shivanshu26shiv
My input is like,

XXXA1B10
XXXA1B10
XXXA1B10
XXXA1B10
XXXA1B10
XXXA1B20
XXXA1B20
XXXA1B20

And I need to check if duplicates are more than 4 then print only those using DFSORT,
hence my output will be,

XXXA1B10
XXXA1B10
XXXA1B10
XXXA1B10

Please help,

I used SELECT FROM(IN) TO(OUT) ON(1,08,CH) HIGHER(4) , which is incorrect...hence please help to rectify.

Re: Printing duplicates if they are greater than x

PostPosted: Thu Jun 18, 2015 5:58 pm
by BillyBoyo
Your SELECT gives you "all records where there are at least four records with the same key".

For your data, you will get five records.

So, what is your actual problem. Can you show what you got which made you think the output was "incorrect"?

Re: Printing duplicates if they are greater than x

PostPosted: Thu Jun 18, 2015 6:13 pm
by shivanshu26shiv
Thanks for explaining Bill,
What I thought it would print is, it should display 4 records. My expected output is shown in the question which is 4 records.
So please tell what I am missing...

Re: Printing duplicates if they are greater than x

PostPosted: Thu Jun 18, 2015 6:22 pm
by BillyBoyo
You have five input records with the same key, so it will print five, not four.

Re: Printing duplicates if they are greater than x

PostPosted: Thu Jun 18, 2015 6:33 pm
by BillyBoyo
Looking back, you specify 4 for the HIGHER. You'll only get those with five or more records for the same key (ie higher than 4).

If you want four or more, you need HIGHER(3).

Re: Printing duplicates if they are greater than x

PostPosted: Mon Jul 06, 2015 7:42 pm
by shivanshu26shiv
Got it, thanks :)