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
 

 

Limit duplicate records in the SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Mon Nov 21, 2016 12:54 pm    Post subject: Limit duplicate records in the SORT
Reply with quote

Hi All,
I have a requirement to limit number of duplicate records in a file.

For e.g:
Below is the record pattern

Code:
AAA
AAA
BBB
BBB
BBB
BBB
CCC
CCC
CCC
DDD

Requirement is to have max 2 duplicate records. So my o/p should be

Code:
AAA
AAA
BBB
BBB
CCC
CCC
DDD

Thanks.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10292
Location: italy

PostPosted: Mon Nov 21, 2016 1:03 pm    Post subject: Reply to: Limit duplicate records in the SORT
Reply with quote

tell us what sort product You will be using.

look at the messages

WER... ==> SYNCSORT
ICE... ==> IBM DFSORT

and the topic will be moved to the proper section
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Mon Nov 21, 2016 1:06 pm    Post subject:
Reply with quote

We use SYNCSORT
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1539
Location: Andromeda Galaxy

PostPosted: Mon Nov 21, 2016 2:09 pm    Post subject:
Reply with quote

Use WHEN=GROUP
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Nov 21, 2016 2:22 pm    Post subject: Reply to: Limit duplicate records in the SORT
Reply with quote

Assuming your data is in key order, extend record temporarily with a sequence number, with RESTART= for the key, and out OUTFIL with INCLLUDE=/OMIT= to do the limiting, with BUILD to drop off the extension.

The same could be achieved with WHEN=GROUP, but if the key is on each record, in the same position, then it is better to use the plain sequence number.
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Mon Nov 21, 2016 3:50 pm    Post subject: Reply to: Limit duplicate records in the SORT
Reply with quote

Hi Bill,

Yes, its in sorted order and key is always in same position.
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 70
Location: India

PostPosted: Mon Nov 21, 2016 4:01 pm    Post subject:
Reply with quote

Thanks Bill & Pandora for your suggestion.

I used sequence number technique. It works. Thanks a lot
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing sort Card Dynamically vickey_dw DFSORT/ICETOOL 3 Sat Aug 19, 2017 2:33 pm
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


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