View previous topic :: View next topic
Author
Message
obulisankar New User Joined: 03 May 2007Posts: 20 Location: bangalore
Hi All,
I have two Input files both having same record length of 160. The common keys on which ICETOOL should compare these two files are not located in same column positions (i.e., On 1st file it is from 147 - 148 and on the second fil it is from 1 - 2). After comparison I want the matching records to be in one file and non matching records to be in other file. I also want to retain the duplicates of both matching and non-matching records in the output files.
Lets take the foll scenario:
Infile1 :
At positon 147-148 (binary)
10
10
10
10
10
20
30
Infile 2:
At positon 1-2 (binary)
10
25
The expected output files are:
OUTFILE1:
10
10
10
10
10
OUTFILE1:
20
30
The outfiles got with the following job are:
OUTFILE1:
10
OUTFILE2:
10
10
10
10
20
30
Below is the job i am currently using:
Code:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//QTR1FILE DD DSN=INFILE1,DISP=OLD
//RT7CLSCD DD DSN=INFILE2,DISP=OLD
//OUT1 DD DSN=OUTFILE1,
// SPACE=(CYL,(10,10),RLSE),
// DISP=(,CATLG,CATLG)
//OUT2 DD DSN=OUTFILE2,
// SPACE=(CYL,(10,10),RLSE),
// DISP=(,CATLG,CATLG)
//T1 DD DSN=&&T1,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//TOOLIN DD *
COPY FROM(QTR1FILE) TO(T1) USING(CTL1)
COPY FROM(RT7CLSCD) TO(T1) USING(CTL4)
SPLICE FROM(T1) TO(OUT1) ON(147,2,BI) WITHALL -
WITH(182,1) KEEPNODUPS USING(CTL5)
/*
//CTL1CNTL DD *
* MARK FILE1 RECORDS WITH '11'
OUTREC FIELDS=(1,160,181:C'11')
/*
//CTL4CNTL DD *
* MARK FILE2 RECORDS WITH '44'
OUTREC FIELDS=(147:1,2,181:C'44')
/*
//CTL5CNTL DD *
* WRITE MATCHING RECORDS TO OUT12 FILE. REMOVE ID.
OUTFIL FNAMES=OUT1,INCLUDE=(181,2,CH,EQ,C'14'),OUTREC=(1,160)
* WRITE FILE1 ONLY RECORDS TO OUT1 FILE. REMOVE ID.
OUTFIL FNAMES=OUT2,INCLUDE=(181,2,CH,EQ,C'11'),OUTREC=(1,160)
/*
//OUT DD SYSOUT=*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//QTR1FILE DD DSN=INFILE1,DISP=OLD
//RT7CLSCD DD DSN=INFILE2,DISP=OLD
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=OUTFILE1,
// SPACE=(CYL,(10,10),RLSE),
// DISP=(,CATLG,CATLG)
//OUT2 DD DSN=OUTFILE2,
// SPACE=(CYL,(10,10),RLSE),
// DISP=(,CATLG,CATLG)
//TOOLIN DD *
COPY FROM(RT7CLSCD) TO(T1) USING(CTL1)
COPY FROM(QTR1FILE1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(147,2,BI) KEEPBASE KEEPNODUPS -
WITHALL WITH(1,161) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(147:1,2,161:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(161:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(161,2,CH,EQ,C'VB'),
BUILD=(1,160)
OUTFIL FNAMES=OUT2,INCLUDE=(161,2,CH,EQ,C'VV'),
BUILD=(1,160)
/*
Back to top
obulisankar New User Joined: 03 May 2007Posts: 20 Location: bangalore
Thanks a lot Frank!!!!!! It was of great help.
Back to top
Please enable JavaScript!