Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2285
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us