Hi,
See the nature of your problem what i think is that you are getting unwanted categories. What you want is A > 500, B >1000 and so on while you are getting A, B, C too... in addition to the categories you want.
The problem what i am seeing is that you may have the values A, B, C coming from the Database (iqd). So, what you need to do is check whether the unwanted values exist in the DB. What you can do is to write a script like
' select distinct custat1d from <tablenames> where <all the conditions>'
and see if the result you get also has A, B etc with the result u wanted. If you are getting these results then either u have to change the DB or supress the categories
Vish