Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SYNCSORT Remove Duplicates conditionally

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SYNCSORT Remove Duplicates conditionally
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    Post subject:
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: 188
Location: india

PostPosted: Tue Mar 11, 2008 8:15 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Mar 13, 2008 3:39 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us