You can't just use "any sort", you have to use the one installed at your site. We don't know which that is.
You need to consult your manual(s) and become familiar with IFTHEN=(WHEN=GROUP and PUSH= with an ID.
Once your groups of records have a value which can be used to keep them together (the ID) then it should be easy to distribute them to one of multiple output files using OUTFIL INCLUE=/OMIT=.
Try it, one thing at at time, and let us know if you get stuck, showing what you tried, what actually happened, what you expected to happen, and input data to create the problem. We need to know the RECFM and LRECL of your files as well.