First File Contains employee id(length = 08) from position 10-17, and status field having 2 values(either 'DR' or 'DT' along with other fields.
2nd file Contains employee id(length = 08) from position 1-8, driver-status-field having only 2 values either 'Active' or 'Inactive') starting at position 1055 to 1063,along with various other fields.
We have to include all those records in the output file where.
If status is 'DR' and the driver-status = 'Active' ------include the record from file 1 to an output file
If status is 'DR' and the driver-status = 'inactive' ------omit the record.
If status is 'DT' and the driver-status = 'Active' ------omit the record.
If status is 'DT'' and the driver-status = 'inactive' ------include the record from file 1 to an output file
We used below Sort Card for the same, but didnt work out. Could you all please help ?
//STEP001 EXEC PGM=SYNCSORT
//SORTJNF1 DD DSN=G1BYAUT.FINAL.PUCVUC.FILE,DISP=SHR
//SORTJNF2 DD DSN=G1BYAUT.DRIVER.INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=G1BYAUT.FINAL.SORTED2,
// DISP=(OLD,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(2,1),RLSE),
// DCB=(BLKSIZE=0,LRECL=1192,RECFM=FB,DSORG=PS)
//MAINSORT DD DSN=G1BYAUT.FINAL.MAINSORT,
// DISP=(OLD,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(2,1),RLSE),
// DCB=(BLKSIZE=0,LRECL=92,RECFM=FB,DSORG=PS)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(10,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A)
REFORMAT FIELDS=(F1:1,92,F2:1,1100)
OPTION COPY
OUTFIL FNAMES=MAINSORT,INCLUDE=(3,2,CH,EQ,C'DR',AND,1147,5,CH,EQ,C'ACTIVE'),OUTREC=(1,92)
/*
//SORTJNF1 DD DSN=G1BYAUT.FINAL.PUCVUC.FILE,DISP=SHR
//SORTJNF2 DD DSN=G1BYAUT.DRIVER.INPUT.FILE,DISP=SHR
//SORTOUT DD DSN=G1BYAUT.FINAL.SORTED2,
// DISP=(OLD,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(2,1),RLSE),
// DCB=(BLKSIZE=0,LRECL=1192,RECFM=FB,DSORG=PS)
//MAINSORT DD DSN=G1BYAUT.FINAL.MAINSORT,
// DISP=(OLD,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(2,1),RLSE),
// DCB=(BLKSIZE=0,LRECL=92,RECFM=FB,DSORG=PS)
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(10,8,A)
JOINKEYS FILE=F2,FIELDS=(1,8,A)
REFORMAT FIELDS=(F1:1,92,F2:1,1100)
OPTION COPY
OUTFIL FNAMES=MAINSORT,INCLUDE=(3,2,CH,EQ,C'DR',AND,1147,5,CH,EQ,C'ACTIVE'),OUTREC=(1,92)
/*
For testing purpose included only those records having status as 'DR' and the driver-status = 'Active'