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 to get last duplicate record using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Need to get last duplicate record using SORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Feb 16, 2012 2:16 pm    Post subject: Reply to: Need to get last duplicate record using SORT
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: 1825
Location: UK

PostPosted: Thu Feb 16, 2012 5:52 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Feb 16, 2012 6:09 pm    Post subject: Reply to: Need to get last duplicate record using SORT
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: 1504
Location: Chennai

PostPosted: Thu Feb 16, 2012 6:23 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Thu Feb 16, 2012 6:43 pm    Post subject: Reply to: Need to get last duplicate record using SORT
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 Moderator


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

PostPosted: Fri Feb 17, 2012 12:41 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL 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