You need to first add a sequence number. For a variable-length record, you do that starting in position five. You only have four records, so it can be one digit.
The lonely 5 at the end says "from position five to the end of the record".
Now you can know which record you have, by testing for 5,1 (that's a new 5, containing the sequence number) for 1, 2, 3 or 4.
You do a WHEN=GROUP for sequence 1, with RECORDS=4. You start the PUSH at a position which will not clash with any data.
If your largest LRECL is 20, then PUSH=(25:6,length-4),RECORDS=4.
You do the second GROUP with a PUSH which starts after the data you have just PUSHed from the previous record, RECORDS=3.
One more GROUP in a similar way, data starting at next available position (which you have to calculate).
Then with the OUTFIL, you only want the 4th record, so INCLUDE= for that. IFTHEN=(WHEN=INIT to BUILD the record you want, then a second WHEN=INIT to OVERLAY (or BUILD) to do the JFY. VLTRIM to finish off.
1 a-data a-data
2 b-data a-data b-data
3 c-data a-data b-data c-data
4 d-data a-data b-data c-data
That's a representation of your input data, then the input to OUTFIL.
Do it bit-by-bit, and follow how it is working. If you get stuck, show what you've don't and we'll get you further on.