View previous topic :: View next topic
Author
Message
Prajesh_v_p Active User Joined: 24 May 2006Posts: 133 Location: India
Hi,
I have 1 file with 2 fields.. customer and customer code.
rec1==>Cu1Cd1
rec2==>Cu2Cd2
rec3==>Cu3Cd3
rec4==>Cu3Cd3
rec5==>Cu4Cd4
rec6==>Cu4Cd5
I need elminate dulicates on customer id if the customer code associated are diffrent(ie same customer id with diffrent customer codes are invalid). In this case I need remove records 5 and 6. I am using syncsort.
Thanks in advance,
Prajesh
Back to top
Prajesh_v_p Active User Joined: 24 May 2006Posts: 133 Location: India
I tried with this sort card.. But still I am left with one occurance..
as expected with SUM FIELDS=NONE
INREC OVERLAY=(118:SEQNUM,4,ZD,RESTART=(101,17))
SORT FIELDS=(1,12,ZD,A,118,4,ZD,A)
SUM FIELDS=NONE
OUTREC BUILD=(1,100)
Note: 1,12 forms the Cust id and 101,17 forms Cust code
Back to top
rajatbagga Active User Joined: 11 Mar 2007Posts: 199 Location: india
Hi Prajesh_v_p
Just try this untested code and see it give you correct results as per your req.
Code:
//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,12,ZD) ON(101,17,ZD) FIRSTDUP
/*
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
here is a slightly more efficient piece of code than my previous version
Code:
//S1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//T2 DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//T3 DD DSN=&&T3,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//IN DD DSN=input file,DISP=SHR
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(T2) ON(1,12,ZD) ON(101,17,ZD) NODUPS DISCARD(T3)
SELECT FROM(T2) TO(T3) ON(1,12,ZD) NODUPS
COPY FROM(T3) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(118:SEQNUM,4,ZD)
/*
//CTL2CNTL DD *
SORT FIELDS=(118,4,BI,A) 1
OUTREC BUILD=(1,117)
Gerry
Back to top
Please enable JavaScript!