Based on Skolusu's example given to me, I have modified my code according to my requirement and started running now,
it is failing with 'SORT CAPACITY EXCEEDED - RECORD COUNT 88792978'
I tried giving options like below, but still it is giving same error. Please let me know how can I overcome from this issue.
Option 1:
1) //SORTWKXX DD UNIT=SYSDA,SPACE=(CYL,(6200,6200),RLSE) - -like this I have given 29 files
Option 2: remove SORTWK files and instead add below
//DFSPARM DD *
OPTION DYNALLOC=(SYSDA,255)
/*
My current code is below
//SAUSRT02 EXEC PGM=ICETOOL,
// COND=(0,NE)
//TOOLMSG DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//DFSMSG DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//SYSPRINT DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//SYSOUT DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//INFILE1 DD DSN=A.B.C, - - - - 25 million records
// DISP=SHR
//INFILE2 DD DSN=B.C.D.,DISP=SHR - - - - -17000 RECORDS
//TEMP1 DD DSN=TEMP1,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1025),
// SPACE=(1025,(50,50),RLSE),AVGREC=K
//TEMP2 DD DSN=TEMP2,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1025),
// SPACE=(1025,(50,50),RLSE),AVGREC=K
//TEMP3 DD DSN=TEMP3,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1024),
// SPACE=(1024,(50,50),RLSE),AVGREC=K
//TEMP5 DD DSN=&&TWMC5,DISP=(NEW,DELETE,DELETE)
//TEMP6 DD DSN=&&TWMC6,DISP=(MOD,DELETE,DELETE)
//DFSPARM DD *
OPTION DYNALLOC=(SYSDA,255)
/*
//TOOLIN DD *
COPY FROM(INFILE1) TO(TEMP1) USING(XBI0)
COPY JKFROM TO(TEMP2) USING(XBI1)
COPY FROM(TEMP2) TO(TEMP3) USING(XBI2)
/*
//XBI0CNTL DD *
OUTREC FIELDS=(1,37,38,2,BI,TO=ZD,LENGTH=03,40,985)
/*
//XBI1CNTL DD *
JOINKEYS F1=TEMP1,FIELDS=(1026,1,A),SORTED,NOSEQCK
JOINKEYS F2=INFILE2,FIELDS=(64,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,1034,F2:2,12)
INREC IFOUTLEN=1034,
IFTHEN=(WHEN=((960,1,CH,EQ,C'N'),AND,(1041,4,SS,EQ,C'**'),AND,
(38,3,ZD,GE,1035,3,ZD),AND,(38,3,ZD,LE,1038,3,ZD)),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=((960,1,CH,EQ,C'N'),AND,(131,4,ZD,EQ,1041,4,ZD),AND,
(38,3,ZD,GE,1035,3,ZD),AND,(38,3,ZD,LE,1038,3,ZD)),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=((960,1,CH,EQ,C'Y'),AND,(131,4,ZD,EQ,1041,4,ZD),AND,
(1035,3,SS,EQ,C'**'),AND,(1038,3,SS,EQ,C'**')),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=NONE,
BUILD=(1,574,C'OT',577,449,1027,8,C'1'))
SORT FIELDS=(1026,9,CH,A)
OUTFIL REMOVECC,NODETAIL,BUILD=(1025X),
SECTIONS=(1026,8,HEADER3=(1,1025))
/*
//JNF1CNTL DD *
INREC BUILD=(1,1025,X,SEQNUM,8,ZD)
//*
//JNF2CNTL DD *
INREC BUILD=(1,63,X)
//*
/*
//XBI2CNTL DD *
OUTREC FIELDS=(1,37,38,2,BI,TO=ZD,LENGTH=03,40,985)
/*
// COND=(0,NE)
//TOOLMSG DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//DFSMSG DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//SYSPRINT DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//SYSOUT DD SYSOUT=A,FLASH=F003,
// DEST=LOCAL
//INFILE1 DD DSN=A.B.C, - - - - 25 million records
// DISP=SHR
//INFILE2 DD DSN=B.C.D.,DISP=SHR - - - - -17000 RECORDS
//TEMP1 DD DSN=TEMP1,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1025),
// SPACE=(1025,(50,50),RLSE),AVGREC=K
//TEMP2 DD DSN=TEMP2,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1025),
// SPACE=(1025,(50,50),RLSE),AVGREC=K
//TEMP3 DD DSN=TEMP3,DISP=(NEW,CATLG,DELETE),
// DCB=(SRCDSCB,RECFM=FB,LRECL=1024),
// SPACE=(1024,(50,50),RLSE),AVGREC=K
//TEMP5 DD DSN=&&TWMC5,DISP=(NEW,DELETE,DELETE)
//TEMP6 DD DSN=&&TWMC6,DISP=(MOD,DELETE,DELETE)
//DFSPARM DD *
OPTION DYNALLOC=(SYSDA,255)
/*
//TOOLIN DD *
COPY FROM(INFILE1) TO(TEMP1) USING(XBI0)
COPY JKFROM TO(TEMP2) USING(XBI1)
COPY FROM(TEMP2) TO(TEMP3) USING(XBI2)
/*
//XBI0CNTL DD *
OUTREC FIELDS=(1,37,38,2,BI,TO=ZD,LENGTH=03,40,985)
/*
//XBI1CNTL DD *
JOINKEYS F1=TEMP1,FIELDS=(1026,1,A),SORTED,NOSEQCK
JOINKEYS F2=INFILE2,FIELDS=(64,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,1034,F2:2,12)
INREC IFOUTLEN=1034,
IFTHEN=(WHEN=((960,1,CH,EQ,C'N'),AND,(1041,4,SS,EQ,C'**'),AND,
(38,3,ZD,GE,1035,3,ZD),AND,(38,3,ZD,LE,1038,3,ZD)),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=((960,1,CH,EQ,C'N'),AND,(131,4,ZD,EQ,1041,4,ZD),AND,
(38,3,ZD,GE,1035,3,ZD),AND,(38,3,ZD,LE,1038,3,ZD)),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=((960,1,CH,EQ,C'Y'),AND,(131,4,ZD,EQ,1041,4,ZD),AND,
(1035,3,SS,EQ,C'**'),AND,(1038,3,SS,EQ,C'**')),
BUILD=(1,574,1045,2,577,449,1027,8,X)),
IFTHEN=(WHEN=NONE,
BUILD=(1,574,C'OT',577,449,1027,8,C'1'))
SORT FIELDS=(1026,9,CH,A)
OUTFIL REMOVECC,NODETAIL,BUILD=(1025X),
SECTIONS=(1026,8,HEADER3=(1,1025))
/*
//JNF1CNTL DD *
INREC BUILD=(1,1025,X,SEQNUM,8,ZD)
//*
//JNF2CNTL DD *
INREC BUILD=(1,63,X)
//*
/*
//XBI2CNTL DD *
OUTREC FIELDS=(1,37,38,2,BI,TO=ZD,LENGTH=03,40,985)
/*