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
 

 

Removing Duplicates based on certain value of the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Dec 09, 2016 4:40 am    Post subject: Removing Duplicates based on certain value of the records
Reply with quote

Hi All,

i want to apply my eliminate duplicate logic(sum fields=None or sortxsum using ICETOOL) on certain records from input and remaining records should be copied to out put as is.

something like this

input is
aaa 123 a1 testing1
aaa 123 a1 testing1
aaa 124 b1 testing1
aaa 124 b1 testing1

output should be

aaa 123 a1 testing1
aaa 124 b1 testing1
aaa 124 b1 testing1

so it is basically when field has value a1 i want to eliminate duplicates and at the same time i want all other records in my output file. i have tried select statement using CTL1 but i am missing something.

this is what i have tried

SELECT FROM(inputfile ) TO(outputfile)-
ON(01,03,CH) ON(04,03,CH) ON(09,08,CH)-
FIRST DISCARD(SORTXSUM)-
USING(CTL1)

and my CTL1 is

INCLUDE COND=(07,2,CH,EQ,C'a1')

i know this will select records with only a1 but i tried all other options too
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Dec 09, 2016 5:14 am    Post subject: Reply to: Removing Duplicates based on certain value of the records
Reply with quote

Can "a1" appear with other keys as well? If so, do you want to keep the first of each key, or only the first "a1"?
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Dec 09, 2016 8:21 pm    Post subject:
Reply with quote

Bill, yes. a1 might appear with other keys also and i want to keep the first of each key
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Dec 09, 2016 8:35 pm    Post subject: Reply to: Removing Duplicates based on certain value of the records
Reply with quote

WHEN=GROUP with KEYBEGIN and PUSH a SEQ (make sure it is large enough to accomodate the maximum number of records for a key) to temporarily extend your records, and use OUTFIL OMIT= to discard any record with "a1" and SEQ-field greater than one. Use BUILD to drop off them temporary extension.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Fri Dec 09, 2016 8:44 pm    Post subject:
Reply with quote

And the assumption is that the input is already sorted on the key.
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Dec 09, 2016 8:49 pm    Post subject:
Reply with quote

No input is not sorted on the key.

@Bill could you give me the sort card ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Dec 09, 2016 9:02 pm    Post subject: Reply to: Removing Duplicates based on certain value of the records
Reply with quote

If the input is not in key order, why did you show your sample data to be in key order?

What order do you want the output to be in? Do you have a preference for which 'a1' is retained for a particular key, given that they may be scattered across your input?

There are loads of examples here (and elsewhere). It is not rocket surgery once you have the outline. Of course, you've just changed the outline.
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Dec 09, 2016 9:29 pm    Post subject:
Reply with quote

ok i will do my search for examples.

Thank you for your tips
Back to top
View user's profile Send private message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Fri Dec 09, 2016 11:07 pm    Post subject: Final solution
Reply with quote

Ok so this is what i have done finally and i got my desired result:

SELECT FROM(inputfile ) TO(outputfile1)-
ON(01,03,CH) ON(04,03,CH) ON(09,08,CH)-
FIRST DISCARD(SORTXSUM)-
USING(CTL1)

COPY FROM(inputfile ) TO(outputfile2)-
USING(CTL2)


and my CTL1 is

INCLUDE COND=(07,2,CH,EQ,C'a1')

and my CTL2 is

INCLUDE COND=(07,2,CH,NE,C'a1')

i got my result in two different files outputfile1 and outputfile2 and i am ok with that.
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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