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

Need to get last duplicate record using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinuk2009

New User


Joined: 30 Apr 2009
Posts: 19
Location: chennai

PostPosted: Thu Feb 16, 2012 1:21 pm
Reply with quote

Hi,

I have a FB file and LRECL is 40. key value starts at 10 th position and ends at 17th position. I need to get the last duplicate record from this file and remove all the other records. I know the solution through ICETOOL. But I do not know by using SORT. could some one please help me on this.

Thanks,
Vinod.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 16, 2012 2:16 pm
Reply with quote

Well, you can look at the SUM statement in the documentation.

Just in case there is nothing there*: take your sorted file to another step, where you add a sequence number, re-sort on the original key plus the sequence number, descending. Do the SUM.

If you try to do this in one step, your "last" record could vary from run to run.

*there isn't
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Feb 16, 2012 5:52 pm
Reply with quote

Just the last duplicate so if there are a million duplicates you want to ignore 999,999 duplicate records?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Feb 16, 2012 6:09 pm
Reply with quote

this is the most puzzling kind of questions...

if something is duplicate then what difference does it make which one is being picked up

it would be better to review the definition of duplicate
icon_cool.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Feb 16, 2012 6:23 pm
Reply with quote

@Enrico & Nic, I think the TS wants to eliminate duplicate key values and keep the last record of "EACH" key. (I can hear your mind voice saying "thank you captain obvious :-)" )

@vinuk2009 the requirement seems to be straight forward.
If you provide input and output records someone might be able to provide a correct solution.
Or
If you know the ICETOOL solution, post it. So we can try to convert it to a PGM=SORT.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Feb 16, 2012 6:43 pm
Reply with quote

You might try something along the lines of
Code:

   SORT FIELDS=COPY                                                     
   OUTFIL REMOVECC,NODETAIL,                                             
     SECTIONS=(10,8,TRAILER3=(1,40))             


modify the 10,8 and the 1,40 according to your needs

or

Code:
 
   OPTION EQUALS                                                         
   SORT FIELDS=(10,8,CH,A)                                                                 
   OUTFIL REMOVECC,NODETAIL,                                             
     SECTIONS=(10,8,TRAILER3=(1,40))                                       


just run some experiments on a simple datasets
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 17, 2012 12:41 am
Reply with quote

Quote:
I know the solution through ICETOOL. But I do not know by using SORT.


If you know how to do it with DFSORT's ICETOOL (PGM=ICETOOL), then why do you need to do it with DFSORT (PGM=SORT) instead? ICETOOL is part of DFSORT - has been for many, many years.
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 -> DFSORT/ICETOOL

 


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