In each case of the 5 cases ,the records have same CIC and FAC.
Records of CIC1 have overlapping dates and should come out
Records of CIC2 have overlapping dates and should come out
Records of CIC3 have mutually exclusive dates and should be eliminated
Records of CIC4 have mutually exclusive dates and should be eliminated
Records of CIC5 ,when you compare the first 2 records,they dont have any overlapping dates.But,when the 2nd record is compared to other records,they have overlapping dates.So ideally,we need to get the other 3 records in the output leaving out the first record. This might happen with only 3rd and 4th records too having the overlapping dates,leaving the first 2 records.
Similarly,there can be 10 records for same CIC and FAC and the first 8 do NOT have a overlap but the 9th record has an overlap.It is like we need to verify each record with every other record of the same key and and the number of records per key varies.
Here,Date_Eff always less than the Date_Off .
Considering the order of dates too, for pair of records that does not have overlapping dates:
I have tried to narrow down my requirements and answered the questions in DFSORT forum too.But,with suggestions from the senior members that this logic can be done with cobol program I had to come here.As i have got less time to come up with the logic,I thought I would get the required pointers in this forum from senior folks like you to kick off my work asap.Please excuse me if you feel that I'm repeating the question in different forums.