IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SYNCSORT Remove Duplicates conditionally


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Tue Mar 11, 2008 3:50 pm
Reply with quote

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
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Tue Mar 11, 2008 6:49 pm
Reply with quote

I tried with this sort card.. But still I am left with one occurance.. icon_cry.gif
as expected with SUM FIELDS=NONE icon_neutral.gif

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
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Mar 11, 2008 8:15 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 13, 2008 3:39 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
Search our Forums:

Back to Top