1. In output first record is sorted child with parent same as master cust.
2. The next record should one where parent is same as child in previous
record i.e. 0222139
3. If there is no record with parent equal to child in previous record then
record with parent equal to parent in previous record should come.
4. Also note '999' is a child under two different parents. In one place
sequence number is - 285250 where as in another place the sequence
number is 354035. As we can see the records with same sequence
number should be in sequence subject to the parent child relationship.
5. There can be multiple master cust in the input file. So records for each
master cust should be together with the sequence as above.
I know its a bit complicated to understand. Please let me know if you have some ideas to make it simpler