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: 2284
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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am


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