Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 83
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: 10391
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: 83
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: 1544
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: 7314

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: 83
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: 83
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 Skip records depends on count lakshmiibmmainframes DFSORT/ICETOOL 5 Sun Dec 24, 2017 9:51 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 9 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us