View previous topic :: View next topic |
Author |
Message |
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Wed Mar 25, 2009 6:21 am Post subject: Eliminating duplicates |
|
|
Hi,
I've input file as below
Code: | 11OH513398045135730203999NN
11OH513459045134590237999NN
11OH513398045133983469999NN
11OH513573045133983408999NN
11OH513770045133983165999NN
11OH513770045133390296999NN
11OH330841043308478345999NN
11OH330392043308470279999NN
11OH330841043308470229999NN
11OH330683043306841241999NN
11OH330682043306841207999NN
11OH330683043306841203999NN
11OH330872223308721114634NN
11OH330202043302029037430NN
11OH330202043302029091069NN
11OH330202043302620394664NN
11OH330202043302627780664NN
11OH330262243302621595489NN
09OH330264043303451530505NN
09OH330287043303457386505NN |
I need to eliminate duplicates from this in positions 5,10 I mean i need only unique values in 5,10 and 1,4 should be 11OH. I tried with sumfields none but its giving repeated values in 5,10.
Please suggest a sort card.
Thanks in advance
Nadh |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Mar 25, 2009 11:14 am Post subject: |
|
|
nadh,
Use the following control cards
Code: |
//SYSIN DD *
OPTION EQUALS
INCLUDE COND=(1,4,CH,EQ,C'11OH')
SORT FIELDS=(5,5,CH,A)
SUM FIELDS=NONE
/* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nadh Intermediate
Joined: 08 Oct 2004 Posts: 192 Topics: 89
|
Posted: Wed Mar 25, 2009 11:30 am Post subject: |
|
|
Hi,
Thank you Kolusu.
It's working. I also tested without OPTION EQUALS even then its working.
What is the use of OPTION EQUALS. In INCLUDE cond we are specifying EQ then why again OPTION EQUALS is there any specific use of it.
Thanks in advance
Nadh |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Mar 25, 2009 11:49 am Post subject: |
|
|
nadh,
OPTION EQUALS has got nothing to do with INCLUDE COND.
Include COND is filtering the desired records where as OPTION EQUALS specifies whether the original sequence of records that collate identically for a sort or a merge should be preserved from input to output.
As a simple example:
Code: |
AAAA R1
AAAA R2
AAAA R3
|
If we sort these three records on positions 1-4 with EQUALS with DFSORT,the output is guaranteed to be:
Code: |
AAAA R1
AAAA R2
AAAA R3
|
because EQUALS says to keep records with the same key (duplicate records) in their original order.
However, if we sort these three records on positions 1-4 with NOEQUALS with DFSORT the output can have those records in any order, e.g.
Code: |
AAAA R2
AAAA R3
AAAA R1
|
or
Code: |
AAAA R3
AAAA R1
AAAA R2
|
because NOEQUALS says that records with the same key can be in any order.
Your shop might already have the OPTION EQUALS as a default option.
Hope this helps... _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|