Joined: 09 Mar 2011 Posts: 7310 Location: Inside the Matrix
Sorry, just flitting in and out, and didn't look at your code, just the output.
You need to do the PARSE on INREC, to make one long record with all your PARSEd fields on, noting that you need your 1,4 data prefixing each PARSEd field:
You have 20 for your names, so you need the TOLEN to be 24. This will chop up your records into 24 bytes, and OUTFIL will see them one-at-a-time. So you have an OUTFIL just to do the OMIT (if you need final formatting, inserting of blanks perhaps, you can do it on BUILD in OUTFIL).
Check all the 20 bytes for space, else you can be trapped by a leading blank on a name.