I have 2 files to which I append XA to 1st file and XB to 2nd file. Then I concatenate both files and sort them based in key fields (7,8) and the appended field so that I always get the XA record first in case of duplicates. I am using a temporary file to concatenate the records and got the desired output. But in my company they don't allow us to use Temporary file with MOD as disposition parameter. Is there a way to achieve this without temporary file. Below in the JCL used.
//DATA1 DD DISP=SHR,DSN=TEST.TRIN.PMR756XA.MCPIPEFL(+0)
//DATA2 DD DISP=SHR,DSN=TEST.UPLD.PMR756XB.UNCVPCFL(+0)
//*
//T1 DD DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(RECFM=VB,LRECL=1366,BLKSIZE=0),
// SPACE=(TRK,(15,500)),
// DSN=TEST.SPLIC49.ACCOUNTS.BOTH
//OUTDD DD DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(RECFM=VB,LRECL=1364,BLKSIZE=0),
// SPACE=(TRK,(15,500)),
// DSN=TEST.SPLIC69.ACCOUNTS.BOTH
//CTL1CNTL DD *
OMIT COND=(5,4,CH,EQ,C'UTRL')
OUTREC BUILD=(1,4,C'XA',7:5)
/*
//*
//CTL2CNTL DD *
OMIT COND=((5,4,CH,EQ,C'UHDR',AND,1,2,BI,LT,18),OR,
(5,4,CH,EQ,C'UTRL'))
OUTREC BUILD=(1,4,C'XB',7:5)
/*
//*
//CTL3CNTL DD *
SORT FIELDS=(7,8,CH,A,5,2,CH,A)
OUTREC BUILD=(1,4,5:7)
/*
//*
//*
//TOOLIN DD *
COPY FROM(DATA1) TO(T1) USING(CTL1)
COPY FROM(DATA2) TO(T1) USING(CTL2)
COPY FROM(T1) TO(OUTDD) USING(CTL3)
/*
//*
//DATA2 DD DISP=SHR,DSN=TEST.UPLD.PMR756XB.UNCVPCFL(+0)
//*
//T1 DD DISP=(MOD,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(RECFM=VB,LRECL=1366,BLKSIZE=0),
// SPACE=(TRK,(15,500)),
// DSN=TEST.SPLIC49.ACCOUNTS.BOTH
//OUTDD DD DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(RECFM=VB,LRECL=1364,BLKSIZE=0),
// SPACE=(TRK,(15,500)),
// DSN=TEST.SPLIC69.ACCOUNTS.BOTH
//CTL1CNTL DD *
OMIT COND=(5,4,CH,EQ,C'UTRL')
OUTREC BUILD=(1,4,C'XA',7:5)
/*
//*
//CTL2CNTL DD *
OMIT COND=((5,4,CH,EQ,C'UHDR',AND,1,2,BI,LT,18),OR,
(5,4,CH,EQ,C'UTRL'))
OUTREC BUILD=(1,4,C'XB',7:5)
/*
//*
//CTL3CNTL DD *
SORT FIELDS=(7,8,CH,A,5,2,CH,A)
OUTREC BUILD=(1,4,5:7)
/*
//*
//*
//TOOLIN DD *
COPY FROM(DATA1) TO(T1) USING(CTL1)
COPY FROM(DATA2) TO(T1) USING(CTL2)
COPY FROM(T1) TO(OUTDD) USING(CTL3)
/*
//*
CODE' d