|
|
| Author |
Message |
gaurao
New User
Joined: 27 Mar 2006 Posts: 6
|
|
|
|
Hi Experts..
This is a very common problem.
But at time we also need to retain a Duplicate record
along with Inserted,Deleted or Updated ones.
So how can we retain, say 1st occurence of the duplicated records. |
|
| Back to top |
|
 |
References
|
Posted: Mon Apr 28, 2008 5:38 pm Post subject: Re: SYNCSORT Extending the problem statement |
 |
|
|
 |
Splitted: Mon Apr 28, 2008 5:40 pm by superk From Topic Compare datasets - can this be further improved? (DFSORT/ICETOOL) |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 6725 Location: 221 B Baker St
|
|
|
|
Hello,
Please post some sample data from both input files and the output you want when these are processed.
Also, post the "rules" for processing as well as the attributes for the files. |
|
| Back to top |
|
 |
gaurao
New User
Joined: 27 Mar 2006 Posts: 6
|
|
|
|
See below:
//IN1 DD *
GAURAO 00001
RAMESH 00002
AWARE 99999
/*
//IN2 DD *
GAURAO 68314
RAMESH 00002
VISHAL 22544
/*
//OLD DD SYSOUT=*
//NEW DD SYSOUT=*
//T1 DD DSN=&&T1,SPACE=(TRK,(1,1),RLSE),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,SPACE=(TRK,(1,1),RLSE),DISP=(NEW,DELETE)
//TEMP DD DSN=&&TEMP,SPACE=(TRK,(1,1),RLSE),DISP=(NEW,DELETE)
//IAD DD DSN=&&IAD,SPACE=(TRK,(1,1),RLSE),DISP=(NEW,PASS)
//UPD DD DSN=&&UPD,SPACE=(TRK,(1,1),RLSE),DISP=(NEW,PASS)
//ORG DD DSN=&&ORG,SPACE=(TRK,(1,1),RLSE),DISP=(NEW,PASS)
//CON DD DSN=*.IAD,VOL=REF=*.IAD,DISP=(OLD,DELETE)
// DD DSN=*.UPD,VOL=REF=*.UPD,DISP=(OLD,DELETE)
// DD DSN=*.ORG,VOL=REF=*.ORG,DISP=(OLD,DELETE)
//OUT DD SYSOUT=*
//ORG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(T2) ON(1,12,CH) NODUPS DISCARD(TEMP)
SELECT FROM(TEMP) TO(ORG) ON(1,12,CH) FIRSTDUP USING(CTL5)
SELECT FROM(T2) TO(IAD) ON(1,6,CH) NODUPS DISCARD(UPD) USING(CTL3)
SORT FROM(CON) TO(OUT) USING(CTL4)
//CTL1CNTL DD *
INREC BUILD=(1,12,C'DOLD')
//CTL2CNTL DD *
INREC BUILD=(1,12,C'INEW')
//CTL3CNTL DD *
OUTFIL FNAMES=IAD
OUTFIL FNAMES=UPD,OVERLAY=(13:C'U')
//CTL4CNTL DD *
SORT FIELDS=(1,6,CH,A,12,4,CH,A)
//CTL5CNTL DD *
OUTFIL FNAMES=ORG,OVERLAY=(13:C'ORGL')
/*
Output I got:
AWARE 99999DOLD
GAURAO 00001UOLD
GAURAO 68314UNEW
RAMESH 00002ORGL
VISHAL 22544INEW
I got RAMESH record (first occurence of duplicate)in the above way.
Is there any better method? |
|
| Back to top |
|
 |
|
|
|