Are 'TRAILER' and the count the only fields in the trailer record?
If not, please show what the trailer record looks like. Are there fields in the original trailer record that cannot be recreated in a new trailer record? That is, could we rebuild the trailer record for each output file from scratch or are there fields that we can only get by copying them from the original trailer record?
What is the RECFM and LRECL of the input file?
Is the count in the trailer record a 9-byte ZD field or something else (what)?
The following DFSORT JCL will give you the desired results. We basically mimic the function of split using INREC. Since we are splitting the input into 5 files we add a 8 byte sequm at the end in pd format with a start number of 5, and then divide that seqnum by 5 and get the remainder. So the first record will have a remainder of 0 and the second record will have a remainder of 1, the third record will have a remainder of 2, the fourth record will have remainder of 3 and the 5th record will have a remainder of 4 and the 6th record once again will have a remainder of zero and the cycle of 5 records continues till the end.
Now using this number we start another seqnum on outrec to count the no: of records written to the output. We start with count of 0 because you dont want the trailer record to be counted as part of the total no:f records.
Using OUTFIL we split the records into different based on the remainder and while writting out we overlay the contents of the trailer records with the seqnum we added using outrec.