IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need the last record from the duplicate using sort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Fri Sep 11, 2009 10:50 am
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
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: 2481
Location: @my desk

PostPosted: Fri Sep 11, 2009 11:50 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top