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 and to copy only last duplicate

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


Joined: 22 Apr 2008
Posts: 26
Topics: 9
Location: Mumbai

PostPosted: Fri Jul 30, 2010 4:23 am    Post subject: SORT and to copy only last duplicate Reply with quote

I want to SORT the file and to copy the last duplicate only. For example my input file is as follows:

Input File:
------------
111 A
111 B
222 B
222 C


My output file should look like:
-----------------------------------

111 B
222 C

How we can achieve the above result using SORT?
Back to top
View user's profile Send private message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Fri Jul 30, 2010 9:37 am    Post subject: Reply with quote

Look in the DFSORT manuals under ICETOOL chapter AND SELECT which has a LASTDUP option.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jul 30, 2010 10:25 am    Post subject: Reply with quote

shash_modi,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//IN       DD *                             
111 A                                       
111 B                                       
222 B                                       
222 C                                       
//OUT      DD SYSOUT=*                       
//TOOLIN   DD *                             
  SELECT FROM(IN) TO(OUT) ON(1,3,CH) LASTDUP
//*

_________________
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 -> Application Programming 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