What order do you want the output records in (original order, sorted order, some other order)?
Do you want two output files - one with matched duplicates and another based on TYPE? Or do you just want the output file based on TYPE?
It's not clear what you mean by "Now the set of policy shuld have atleast 2 same TYPES mandatory". Are B and I the only types? Do you want all of the records with a specific policy and commission only if one of those records has TYPE B and another has TYPE I, or do you want something else? Please clarify the "rules".
I don't know what you mean by "Can i get any count number in IOF having such type of policy sets?". What is IOF? Are you looking for a "count" of some kind? In what form? As a separate output file or what?
It would really help if you showed a better example of your input records with more variations and the complete expected output or outputs, and explained the rules for getting from input to output in terms of this better example.
i am trying to break up my requirement below as it is quite confusing to explain.
1) The Final Output file should have records sorted on policy Number and Commision value; however this final output file must have only duplicate policy record.
2) By Duplicate i mean I require only those policy records records which have same corresponding Commision value (some type of code) e.g Policy-1 has 2 commission values 0100 and 0200 this is not the duplicate it must have two same commission value. Then only this policy should be there in the Out file.
Policy Commision Value
This are not the duplicate values
Policy Commision Value
the first 2 records are duplicates and must exist in the output file.
Only those policy which are duplicates and have matching commision shuld be there in outfile.
3) The Above one is the basic requirement. Now there are only 2 policy type 'I' and 'B'. In my example i have 2 set of policies(one with 4 duplicates and other one with 2 duplicates) as explained in above two requirement:
Now i require only those records which have the matching set of values e,g the policy 996082424 with commision value 0012 has two matching sets one with 'I' and other with 'B', all 4 recods of this policy should come in final output file leaving the last two records as they don't have matching set with TYPe 'B'.
i Hope i am able to justify my requirements..I have tried to explain it keeping 2 sort step in mind. may be this whole thing can be done in one sort step which i might not know.
3) I am trying to find the the Count on policy type sets records in my output file. Where my input file may have millions of records.
The way you suggested is doable. But i am bit concerned on the 3rd point.
Say there 5 duplicates of one policy. 3 Duplicates have TYPE 'I' and 2 Duplicates have type 'B' and both these I and B will be in two seperate file. In this case i dont require the data. I would like to see the dupliacte policies only if there are exact 2 occurence of I and B each.
Instead of 'ALLDUPS' use 'FIRSTDUP' in the ICETOOL JCL and create two temp files
File1: INCLUDE COND where TYP='I' and retrieve the first dup record on policy and commission
File2: INCLUDE COND where TYP='B' and retrieve the first dup record on policy and commission
Merge the above two files and get FIRSTDUP to get the required count.
If you need any more information please feel free to reply me.
The following DFSORT/ICETOOL JCL will give you desired results. This will pick all duplicate records which have 2 'I' Records and 2 'B' records. If the input has only 2 'I' records per key or 2 'B' per key then we will skip such records.