MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort card to eliminate dupes and keep specific record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
nishantrk
Beginner


Joined: 24 Mar 2006
Posts: 32
Topics: 16

PostPosted: Fri Nov 12, 2010 8:43 pm    Post subject: Sort card to eliminate dupes and keep specific record Reply with quote

This should be a general problem , but i couldn't figure it out nor find the right solution , though have searched various forums

Record length 80 , VB

Code:
111111A20101008
111111S20101008
222222S20101008
333333A20101010
333333U20101010
333333S20101010
444444A20101010
444444U20101010
555555U20101010
666666A20101012


Output should eliminate duplicate based of first 6 char and Keep one of the record based on the 7th char
Rules 'S" has highest priority then "U" then "A"

So the output should be

Code:
111111S20101008
222222S20101008
333333S20101010
444444U20101010
555555U20101010
666666A20101012

Am open to any utilities DFSORT ,SYNCSORT or FILE AID ??
Thanks in advance for your valuable inputs
Back to top
View user's profile Send private message Send e-mail
nishantrk
Beginner


Joined: 24 Mar 2006
Posts: 32
Topics: 16

PostPosted: Fri Nov 12, 2010 8:52 pm    Post subject: Reply with quote

Sorry missed a thing the output should have a additional indicator telling that the record had dupes

Code:
111111S20101008 I
222222S20101008
333333S20101010 I
444444U20101010 I
555555U20101010
666666A20101012
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Nov 12, 2010 10:34 pm    Post subject: Reply with quote

nishantrk,

Try the following untested DFSORT/ICETOOL JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD DSN=Your Input VB File,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)         
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                     
  SORT FROM(IN) USING(CTL1)                                         
  SELECT FROM(T1) TO(OUT) ON(5,6,CH) LAST USING(CTL2)               
//CTL1CNTL DD *                                                     
  SORT FIELDS=(5,6,CH,A,11,1,AQ,A),EQUALS                           
  ALTSEQ CODE=(E2F9,E4F8)                                           
  OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,2,ZD,RESTART=(5,6),5)),
  IFTHEN=(WHEN=(5,2,ZD,GT,1),OVERLAY=(23:C'I'))                     
  OUTFIL FNAMES=T1,BUILD=(1,4,7)                                   
//*                                                                 
//CTL2CNTL DD *                                                     
  SORT FIELDS=COPY                                                 
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group