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 - Remove duplicates when they occur consecutively

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


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Thu Jun 21, 2007 10:45 am    Post subject: Sort - Remove duplicates when they occur consecutively Reply with quote

Gurus, Is this possible via sort?

If ABC (and only ABC) occurs consecutively I should retain only the last instance.
Quote:
Input:

1123
1ABC
2ABC
4457
6ABC
8593
8593
4345
6ABC
7ABC
8ABC
8478


Quote:
Output:

1123
2ABC
4457
6ABC
8593
8593
4345
8ABC
8478


Relaxing.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 21, 2007 11:40 am    Post subject: Reply with quote

relaxing,

Try this

Code:

//SYSIN    DD *                           
   SORT FIELDS=COPY                       
   OUTREC IFTHEN=(WHEN=INIT,             
         OVERLAY=(5:SEQNUM,8,ZD)),       
          IFTHEN=(WHEN=(2,3,CH,EQ,C'ABC'),
         OVERLAY=(5:8C'0'))               
   OUTFIL REMOVECC,NODETAIL,             
   SECTIONS=(2,11,                       
   TRAILER3=(1,4))                       
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
relaxing
Beginner


Joined: 25 Aug 2003
Posts: 73
Topics: 29

PostPosted: Thu Jun 21, 2007 9:59 pm    Post subject: Reply with quote

Thanks a Ton Kolusu.
Back to top
View user's profile Send private message
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