the input records will be like this. Header is located as '04500' starting (2,5) for all these records the key is located at (42,11). The corresponding detail records will have '04510' in second position
Here for first header the key is 06001014683.
and so on...
I need to sort the headers on its key (42,11) and the corresponding detail records should not be changed in either order and the link between the original header its detail records should be the same.