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

Moderator


Joined: 14 Mar 2007
Posts: 10472
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: 90
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: 1547
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: 90
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: 90
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 MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Duplicate PARM on OUTFIL sancraig16 SYNCSORT 11 Thu Apr 05, 2018 10:25 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Limit in Length for a CICS START seahawk789 CICS 6 Mon Apr 02, 2018 8:34 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm

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