if your intention is to have the first and last group in 2 different files and rest of the groups into a single file, then use the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DISP=SHR,DSN=Your input FB 133 byte file
//INB DD DISP=SHR,DSN=Same input FB 133 byte file
//OUT01 DD SYSOUT=*
//OUT02 DD SYSOUT=*
//OUT03 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(134,8,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(001,8,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,141,?)
OUTFIL FNAMES=OUT01,BUILD=(1,133),INCLUDE=(134,8,ZD,EQ,1)
OUTFIL FNAMES=OUT03,BUILD=(1,133),INCLUDE=(142,1,CH,EQ,C'1')
OUTFIL FNAMES=OUT02,BUILD=(1,133),SAVE
//*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,END=(5,5,CH,EQ,C'TOTAL'),PUSH=(134:ID=8))
//*
//JNF2CNTL DD *
INCLUDE COND=(5,5,CH,EQ,C'TOTAL')
INREC BUILD=(SEQNUM,8,ZD,START=0)
//*
//SYSOUT DD SYSOUT=*
//INA DD DISP=SHR,DSN=Your input FB 133 byte file
//INB DD DISP=SHR,DSN=Same input FB 133 byte file
//OUT01 DD SYSOUT=*
//OUT02 DD SYSOUT=*
//OUT03 DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(134,8,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(001,8,A),SORTED,NOSEQCK
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,141,?)
OUTFIL FNAMES=OUT01,BUILD=(1,133),INCLUDE=(134,8,ZD,EQ,1)
OUTFIL FNAMES=OUT03,BUILD=(1,133),INCLUDE=(142,1,CH,EQ,C'1')
OUTFIL FNAMES=OUT02,BUILD=(1,133),SAVE
//*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=GROUP,END=(5,5,CH,EQ,C'TOTAL'),PUSH=(134:ID=8))
//*
//JNF2CNTL DD *
INCLUDE COND=(5,5,CH,EQ,C'TOTAL')
INREC BUILD=(SEQNUM,8,ZD,START=0)
//*
Bill,
We don't have to SORT and SUM For JNF2, we simply can use a COPY operation using the trick of identifying the last record.