we can use "SORT" utility in JCL for this purpose.
Below i have given JCL code snippet to illustrate on this.
This will create 3 files based on the first 2 numbers in the input file.
Records having first 2 digits "01" will be put in file 1[ SORTOF1]
Records having first 2 digits "02" will be put in file 2 [SORTOF2]
Records having first 2 digits "03" will be put in file 2 [SORTOF3]
===========================================
Add job card info here
//PS01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN="input file name here",DISP=SHR
//*
//SORTOF1 DD DSN=B052DNS.BKS4.RECORD1,
// DISP=(,CATLG,DELETE),
// UNIT=TEST,SPACE=(TRK,(10,50),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF2 DD DSN=B052DNS.BKS4.RECORD2,
// DISP=(,CATLG,DELETE),
// UNIT=TEST,SPACE=(TRK,(10,50),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF3 DD DSN=B052DNS.BKS4.RECORD3,
// DISP=(,CATLG,DELETE),
// UNIT=TEST,SPACE=(TRK,(10,50),RLSE),
// DCB=(B0.DSCB,RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(1,2,ZD,EQ,01)
OUTFIL FILES=2,INCLUDE=(1,2,ZD,EQ,02)
OUTFIL FILES=3,INCLUDE=(1,2,ZD,EQ,03)
//*
==============================================
i hope this will help you.
please inform us , whether this is what you wanted.