kevin Jenkins,
Use the following DFSORT JCL which will give you the desired results. The RC is set to 0 if the file 2 has atleast 1 record more than file 1. An RC of 4 is set when file 2 has equal or less number of records in file 1
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
F1-R1
F1-R2
F1-R3
//INB DD *
F2-R1
F2-R2
F2-R3
F2-R4
F2-R5
F2-R6
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,1,A)
JOINKEYS F2=INB,FIELDS=(1,1,A)
REFORMAT FIELDS=(F1:2,8,F2:2,8)
OUTFIL NULLOFL=RC4,INCLUDE=(9,8,ZD,GT,1,8,ZD)
//*
//JNF1CNTL DD *
INREC BUILD=(X,7C'0',C'1')
SUM FIELDS=(2,8,ZD)
//*
//JNF2CNTL DD *
INREC BUILD=(X,7C'0',C'1')
SUM FIELDS=(2,8,ZD)
//*