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
 

 

Need the last record from the duplicate using sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
nazia.lalani
Warnings : 1

New User


Joined: 20 Mar 2009
Posts: 25
Location: hyderabad

PostPosted: Fri Sep 11, 2009 10:09 am    Post subject: Need the last record from the duplicate using sort
Reply with quote

Hi,
My requirement is

I have an input file in which there are duplicates depending on iCN number
i want to remove the duplicate and want the last record of all the duplictes
icn=12 bytes
date=10 bytes


ICN paid_date
000000000001 2008-01-01
000000000001 2009-01-01
000000000001 2008-01-01
000000000001 2002-01-01
000000000001 2006-01-01

I want the last record: 000000000001 2006-01-01
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Sep 11, 2009 10:50 am    Post subject:
Reply with quote

Hi,

try this

Code:
//STEP0001  EXEC PGM=ICETOOL                     
//TOOLMSG   DD SYSOUT=*                         
//DFSMSG    DD SYSOUT=*                         
//IN        DD *                                 
000000000001 2008-01-01                         
000000000001 2009-01-01                         
000000000001 2008-01-01                         
000000000001 2002-01-01                         
000000000001 2006-01-01                         
//OUT       DD SYSOUT=*                         
//TOOLIN    DD *                                 
SELECT FROM(IN) TO(OUT) ON(1,12,CH) LASTDUP     


Gerry
Back to top
View user's profile Send private message
nazia.lalani
Warnings : 1

New User


Joined: 20 Mar 2009
Posts: 25
Location: hyderabad

PostPosted: Fri Sep 11, 2009 11:28 am    Post subject:
Reply with quote

THANKS...ITS WORKING FINE
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Fri Sep 11, 2009 11:50 am    Post subject:
Reply with quote

nazia.lalani,

If you can have unique key records also in your input, you might want to use LAST instead of LASTDUP.
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


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