Thanks
Holli,
FunkyMonk and
Japhy for all your help. I've finally got it to split correctly by changing the ('chk') which was not pulling all of my columns through correctly into the join and split functions. I have also realised there is a second way of getting this function formatted which may be easier to maintain via the \%fd dump so TMTOWDI! However both ways are useful for another planned script.