I'm trying to sort a file into two output files using DFSORT but after submitting, It only sorts fields with key2. Both KEY1 & KEY2 files have same data which satisfies the conditions of OUTFIL FNAMES=KEY2OUT but OUTFIL FNAMES=KEY1OUT is not executing.
//U299060A JOB MSGLEVEL=1,CLASS=A,NOTIFY=&SYSUID,REGION=1
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=U299060.DFSRTPS.PDS(EXP1INP),DISP=SHR
//KEY1OUT DD DSN=U299060.DFSRTOUT.PDS(KEY1),DISP=OLD
//KEY2OUT DD DSN=U299060.DFSRTOUT.PDS(KEY2),DISP=OLD
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=KEY1OUT,INCLUDE=(3,4,CH,EQ,C'KEY1'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(18:COUNT=(M11,LENGTH=8),
33:TOT=(8,4,ZD,M11,LENGTH=6)))
OUTFIL FNAMES=KEY2OUT,INCLUDE=(3,4,CH,EQ,C'KEY2'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(18:COUNT=(M11,LENGTH=8),
33:TOT=(8,4,ZD,M11,LENGTH=6)))
/*
My Input file is
H 10/12/2010
D KEY1 0100
D KEY1 0300
D KEY2 0200
D KEY2 0050
D KEY1 0625
D KEY1 0300
D KEY2 3000
T DEPT AXY COUNT=00000007 TOTAL=004575
& output is same in both files KEY1 & KEY2
H 10/12/2010
D KEY2 0200
D KEY2 0050
D KEY2 3000
T DEPT AXY COUNT=00000003 TOTAL=003250
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=U299060.DFSRTPS.PDS(EXP1INP),DISP=SHR
//KEY1OUT DD DSN=U299060.DFSRTOUT.PDS(KEY1),DISP=OLD
//KEY2OUT DD DSN=U299060.DFSRTOUT.PDS(KEY2),DISP=OLD
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=KEY1OUT,INCLUDE=(3,4,CH,EQ,C'KEY1'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(18:COUNT=(M11,LENGTH=8),
33:TOT=(8,4,ZD,M11,LENGTH=6)))
OUTFIL FNAMES=KEY2OUT,INCLUDE=(3,4,CH,EQ,C'KEY2'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(18:COUNT=(M11,LENGTH=8),
33:TOT=(8,4,ZD,M11,LENGTH=6)))
/*
My Input file is
H 10/12/2010
D KEY1 0100
D KEY1 0300
D KEY2 0200
D KEY2 0050
D KEY1 0625
D KEY1 0300
D KEY2 3000
T DEPT AXY COUNT=00000007 TOTAL=004575
& output is same in both files KEY1 & KEY2
H 10/12/2010
D KEY2 0200
D KEY2 0050
D KEY2 3000
T DEPT AXY COUNT=00000003 TOTAL=003250
Ridiculous unreadable colour-scheme removed.