I have to compare 2 files say FILE A(conatins duplicates) and FILE B, then
write all the records from FILE A to output file FILE C, which does not have matched records in FILE B.
key: offset 14, length:14 for both input files.
FILE A: record length : 210 and FB
D00000000000000001090000002451902192434249820061128
D00000000000000008880000002451902192434249820061128
D00000000000000001170000002451902192434249820061128
D00000000000000001580000002451902192434249820061128
D00000000000000001110000002451902192434249820061128
D0000000000000000222000002451902192434249820061128
D00000000000000003330000002451902192434249820061128
I'm using the following job but it's not working properly:
Code:
//SORT1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN2 DD DSN=file a
//IN1 DD DSN=file b
//*T1 DD DSN=BB0908.DZT.OSCAR.TEST4,DISP=MOD
//* UNIT=SYSDA,SPACE=(212,(5,5),RLSE),
//* DCB=(RECFM=FB,LRECL=212)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(212,(5,5),RLSE),
// DCB=(RECFM=FB,LRECL=212),DISP=(MOD,PASS)
//F1 DD DSN=&&F1,UNIT=SYSDA,SPACE=(212,(5,5),RLSE),
// DCB=(RECFM=FB,LRECL=212),DISP=(MOD,PASS)
//OUT1 DD DSN=file c
//TOOLIN DD *
* GET FIRST RECORD WITH EACH NAME FROM FILE1.
SELECT FROM(IN1) TO(F1) ON(14,14,CH) FIRST
* GET FIRST RECORD WITH EACH NAME FROM FILE2.
SELECT FROM(IN2) TO(F1) ON(14,14,CH) FIRST
* GET ONE RECORD WITH EACH NAME IN FILE1 AND FILE2
* AND ADD 'AA' IDENTIFIER.
SELECT FROM(F1) TO(T1) ON(14,14,CH) FIRSTDUP USING(CTL1)
* GET ONE RECORD WITH EACH NAME ONLY IN FILE1 OR ONLY IN FILE2
* AND ADD 'BB' IDENTIFIER.
SELECT FROM(F1) TO(T1) ON(14,14,CH) NODUPS USING(CTL2)
*----------------------------------------------------------------*
* ADD '11' IDENTIFIER FOR FILE1 RECORDS.
COPY FROM(IN1) TO(T1) USING(CTL3)
* ADD '22' IDENTIFIER FOR FILE2 RECORDS.
COPY FROM(IN2) TO(T1) USING(CTL4)
* SPLICE TO MATCH UP RECORDS AND WRITE THEM TO THEIR
* APPROPRIATE OUTPUT FILES.
SPLICE FROM(T1) TO(OUT12) ON(14,14,CH) -
WITHALL WITH(1,211) USING(CTL5)
/*
//CTL1CNTL DD
* MARK RECORDS WITH FILE1/FILE2 MATCH WITH 'AA'.
OUTFIL FNAMES=T1,OVERLAY=(211:C'AA')
/*
//CTL2CNTL DD
* MARK RECORDS WITHOUT FILE1/FILE2 MATCH WITH 'BB'.
OUTFIL FNAMES=T1,OVERLAY=(211:C'BB')
/*
//CTL3CNTL DD *
* MARK FILE1 RECORDS WITH '11'
* INREC OVERLAY=(211:C'11')
OUTFIL FNAMES=T1,OVERLAY=(211:C'11')
/*
//CTL4CNTL DD *
* MARK FILE2 RECORDS WITH '22'
* INREC OVERLAY=(211:C'22')
OUTFIL FNAMES=T1,OVERLAY=(211:C'22')
/*
//CTL5CNTL DD *
* WRITE FILE1 ONLY RECORDS TO OUT1 FILE. REMOVE ID.
OUTFIL FNAMES=OUT1,INCLUDE=(211,1,CH,EQ,C'1B'),BUILD=(1,210)
/*
//
my problem still not resolved, actually i want the non matching records from FILEA not from File B and i want duplicates to present in FILE C if they are in FILE A..
If you want something different than you indicated you wanted, then you need to show me the input and output records for that and explain what you want.
If you want what you showed and you're not getting it with my job, then you're doing something different and you need to show me the job you're using, the TOOLMSG and DFSMSG messages you get, and the records in OUT you get.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I can only go by what you tell me. Your original input didn't have duplicates in fileA so I coded the job with that in mind. Your new input does have duplicates in fileA so it requires a different job. Anyway, you seem to have figured out the new job you need.