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: 7308

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: 1756
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: 10232
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: 1476
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: 10232
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 Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm


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