If you want to split into multiple files based on a fixed position with values that you don't know, you are going to need to SORT the data (on the field to split by) and use WHEN=GROUP on OUTREC to have something to be able to INCLUDE on in multiple OUTFILs.
//SYSIN DD *
SORT FIELDS=(6,4,CH,A)
OUTREC IFTHEN=(WHEN=GROUP,
KEYBEGIN=(6,4),
PUSH=(81:ID=2))
OUTFIL INCLUDE=(81,2,CH,EQ,C'01'),
FNAMES=OUT1,
BUILD=(1,80)
OUTFIL INCLUDE=(81,2,CH,EQ,C'02'),
FNAMES=OUT2,
BUILD=(1,80)
OUTFIL SAVE,
FNAMES=OUTA,
BUILD=(1,80)
//SORTIN DD *
1234 ABCD
3991 ABCD
3818 ABCD
1939 PQRS
2838 PQRS
1939 ABCD
2819 PQRS
2102 FILQ
2911 ABCD
3912 FILQ
Gives:
OUT1
1234 ABCD
1939 ABCD
2911 ABCD
3991 ABCD
3818 ABCD
OUT2
3912 FILQ
2102 FILQ
OUTA
1939 PQRS
2819 PQRS
2838 PQRS
I've used 80-byte fixed-length records for testing. If your record-length is different, change all the references to 81 to your-record-length-plus-one and all references to 80 to your record-length.
If your data is on variable-length records, you should have mentioned it earlier. The code is different.
WHEN=GROUP defines a group, and allows information from the definition of the group to be applied to all records in the group (using PUSH). There are two special fields available, ID (a sequence number for groups) and SEQ (a sequence number within the group). ID=2 means a-two-digit sequence number for groups. This allows up to 100 groups before things start going wrong with the code.
There will be 10 OUTFILs (I show three). For the final OUTFIL (I've called it OUTA) I'd suggest using SAVE instead of INCLUDE. SAVE means "all records which aren't on another OUTFIL go here". Even if you get more than 10 groups, at least you'll have all the data (until you exceed 100 groups).
PUSH is similar to OVERLAY, except it cannot use literal values of any type, only the special fields mentioned above and any data from the record which defines the group.
This PUSH will extend the records. To make it a temporary extension, the BUILD in each OUTFIL returns each record to its original size.