The below JCL Sort example best tells conditional include in OUTFIL of OUT1 outfile:

//MATCH EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=… input File1 (FB/10)
//IN2 DD DSN=… input File2 (FB/10)
//OUT12 DD SYSOUT=* keys in File1 and File2
//OUT1 DD SYSOUT=* keys in File1 only
//OUT2 DD SYSOUT=* kesy in File2 only
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,10,A)
JOINKEYS F2=IN2,FIELDS=(1,10,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,10,F2:1,10,?)
OPTION COPY
OUTFIL FNAMES=OUT12,INCLUDE=(21,1,CH,EQ,C’B’),
BUILD=(1,10)
OUTFIL FNAMES=OUT1,INCLUDE=(21,1,CH,EQ,C’1′),
BUILD=(1,10)
OUTFIL FNAMES=OUT2,INCLUDE=(21,1,CH,EQ,C’2′),
BUILD=(11,10)
/*

Advertisements