I need to compare 2 files and output records from file 1 that appear only in file 1.
Both files contain duplicates.
I have got the example in the "Smart Tricks" guide to work. However I am having some difficulty translating it into something that will work for my scenario.
Specific details include:
Match on a binary 4 field.
Record lengths and formats are different for each file: File 1 LRECL=92, File2 LRECL=14, however both have a binary 4 as the first field in each file.
Any help would be much appreciated.
Regards,
Aaron
The JCL I am using follows:
//ICECULL EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//DEFOUT DD SYSOUT=*
//TR DD DSN=APD1.MR.DATA.ATO.TEMP.VISA,DISP=SHR
//PR DD DSN=APD1.MR.DATA.ATO.PERM.VISA,DISP=SHR
//F1 DD DSN=APD1.MR.DATA.ATO.F1,DISP=MOD
//T1 DD DSN=APD1.MR.DATA.ATO.T1,DISP=MOD
//OUT12 DD DSN=EXITAC.ATO.BOTH,DISP=SHR BOTH
//OUT1 DD DSN=APD1.MR.DATA.ATO.TEMP.NOPERM.VISA,DISP=SHR TR ONLY
//OUT2 DD DSN=EXITAC.ATO.ONLYPR,DISP=SHR PR ONLY
//*SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK06 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//TOOLIN DD *
* GET FIRST RECORD OF EACH UNIQUE PID FROM TR
SELECT FROM(TR) TO(F1) ON(1,4,BI) FIRST
* GET FIRST RECORD OF EACH UNIQUE PID FROM PR
SELECT FROM(PR) TO(F1) ON(1,4,BI) FIRST
* GET ONE RECORD WITH EACH PID ONLY IN TR OR ONLY IN PR AND ADD
* 'UU' IDENTIFIER
SELECT FROM(F1) TO(T1) ON(1,4,BI) NODUPS USING(CTL2)
* ADD '11' IDENTIFIER FOR TR RECORDS
COPY FROM(TR) TO(T1) USING(CTL3)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR APPROPRIATE
* OUTPUT FILES
* SPLICE FROM(T1) TO(OUT1) ON(1,4,BI) -
* WITHALL WITH(1,92) USING(CTL5)
/*
//CTL2CNTL DD *
* MARK RECORDS WITHOUT TR/PR MATCH WITH 'UU'
OUTFIL FNAMES=T1,OVERLAY=(93:C'UU')
/*
//CTL3CNTL DD *
* MARK TR RECORDS WITH '11'
OUTFIL FNAMES=T1,OVERLAY=(93:C'11')
/*
//CTL5CNTL DD *
* MARK TR ONLY RECORDS TO OUT1 FILE. REMOVE ID
OUTFIL FNAMES=OUT1,INCLUDE=(93,2,CH,EQ,C'1U'),
BUILD=(1,92)
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//DEFOUT DD SYSOUT=*
//TR DD DSN=APD1.MR.DATA.ATO.TEMP.VISA,DISP=SHR
//PR DD DSN=APD1.MR.DATA.ATO.PERM.VISA,DISP=SHR
//F1 DD DSN=APD1.MR.DATA.ATO.F1,DISP=MOD
//T1 DD DSN=APD1.MR.DATA.ATO.T1,DISP=MOD
//OUT12 DD DSN=EXITAC.ATO.BOTH,DISP=SHR BOTH
//OUT1 DD DSN=APD1.MR.DATA.ATO.TEMP.NOPERM.VISA,DISP=SHR TR ONLY
//OUT2 DD DSN=EXITAC.ATO.ONLYPR,DISP=SHR PR ONLY
//*SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//*SORTWK06 DD UNIT=SYSDA,SPACE=(CYL,(1000,200))
//TOOLIN DD *
* GET FIRST RECORD OF EACH UNIQUE PID FROM TR
SELECT FROM(TR) TO(F1) ON(1,4,BI) FIRST
* GET FIRST RECORD OF EACH UNIQUE PID FROM PR
SELECT FROM(PR) TO(F1) ON(1,4,BI) FIRST
* GET ONE RECORD WITH EACH PID ONLY IN TR OR ONLY IN PR AND ADD
* 'UU' IDENTIFIER
SELECT FROM(F1) TO(T1) ON(1,4,BI) NODUPS USING(CTL2)
* ADD '11' IDENTIFIER FOR TR RECORDS
COPY FROM(TR) TO(T1) USING(CTL3)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR APPROPRIATE
* OUTPUT FILES
* SPLICE FROM(T1) TO(OUT1) ON(1,4,BI) -
* WITHALL WITH(1,92) USING(CTL5)
/*
//CTL2CNTL DD *
* MARK RECORDS WITHOUT TR/PR MATCH WITH 'UU'
OUTFIL FNAMES=T1,OVERLAY=(93:C'UU')
/*
//CTL3CNTL DD *
* MARK TR RECORDS WITH '11'
OUTFIL FNAMES=T1,OVERLAY=(93:C'11')
/*
//CTL5CNTL DD *
* MARK TR ONLY RECORDS TO OUT1 FILE. REMOVE ID
OUTFIL FNAMES=OUT1,INCLUDE=(93,2,CH,EQ,C'1U'),
BUILD=(1,92)
/*
Output from the job follows:
ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED
ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES A
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN
ICE630I 0 MODE IN EFFECT: STOP
* GET FIRST RECORD OF EACH UNIQUE PID FROM TR
SELECT FROM(TR) TO(F1) ON(1,4,BI) FIRST
ICE627I 0 DFSORT CALL 0001 FOR SORT FROM TR TO F1 COMPLETED
ICE628I 0 RECORD COUNT: 000000000088531
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000035191
ICE602I 0 OPERATION RETURN CODE: 00
* GET FIRST RECORD OF EACH UNIQUE PID FROM PR
SELECT FROM(PR) TO(F1) ON(1,4,BI) FIRST
ICE627I 0 DFSORT CALL 0002 FOR SORT FROM PR TO F1 COMPLETED
ICE628I 0 RECORD COUNT: 000000000047178
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000018054
ICE602I 0 OPERATION RETURN CODE: 00
* GET ONE RECORD WITH EACH PID ONLY IN TR OR ONLY IN PR AND ADD
* 'UU' IDENTIFIER
SELECT FROM(F1) TO(T1) ON(1,4,BI) NODUPS USING(CTL2)
ICE606I 0 DFSORT CALL 0003 FOR SORT FROM F1 TO T1 USING CTL2CNTL COM
ICE628I 0 RECORD COUNT: 000000000053245
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000030113
ICE602I 0 OPERATION RETURN CODE: 00
* ADD '11' IDENTIFIER FOR TR RECORDS
COPY FROM(TR) TO(T1) USING(CTL3)
ICE606I 0 DFSORT CALL 0004 FOR COPY FROM TR TO T1 USING CTL3CNTL TER
ICE602I 0 OPERATION RETURN CODE: 16
ICE630I 2 MODE IN EFFECT: SCAN
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR APPROPRIATE
* OUTPUT FILES
* SPLICE FROM(T1) TO(OUT1) ON(1,4,BI) -
* WITHALL WITH(1,92) USING(CTL5)
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16
ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES A
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN
ICE630I 0 MODE IN EFFECT: STOP
* GET FIRST RECORD OF EACH UNIQUE PID FROM TR
SELECT FROM(TR) TO(F1) ON(1,4,BI) FIRST
ICE627I 0 DFSORT CALL 0001 FOR SORT FROM TR TO F1 COMPLETED
ICE628I 0 RECORD COUNT: 000000000088531
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000035191
ICE602I 0 OPERATION RETURN CODE: 00
* GET FIRST RECORD OF EACH UNIQUE PID FROM PR
SELECT FROM(PR) TO(F1) ON(1,4,BI) FIRST
ICE627I 0 DFSORT CALL 0002 FOR SORT FROM PR TO F1 COMPLETED
ICE628I 0 RECORD COUNT: 000000000047178
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000018054
ICE602I 0 OPERATION RETURN CODE: 00
* GET ONE RECORD WITH EACH PID ONLY IN TR OR ONLY IN PR AND ADD
* 'UU' IDENTIFIER
SELECT FROM(F1) TO(T1) ON(1,4,BI) NODUPS USING(CTL2)
ICE606I 0 DFSORT CALL 0003 FOR SORT FROM F1 TO T1 USING CTL2CNTL COM
ICE628I 0 RECORD COUNT: 000000000053245
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000030113
ICE602I 0 OPERATION RETURN CODE: 00
* ADD '11' IDENTIFIER FOR TR RECORDS
COPY FROM(TR) TO(T1) USING(CTL3)
ICE606I 0 DFSORT CALL 0004 FOR COPY FROM TR TO T1 USING CTL3CNTL TER
ICE602I 0 OPERATION RETURN CODE: 16
ICE630I 2 MODE IN EFFECT: SCAN
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR APPROPRIATE
* OUTPUT FILES
* SPLICE FROM(T1) TO(OUT1) ON(1,4,BI) -
* WITHALL WITH(1,92) USING(CTL5)
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 16