View previous topic :: View next topic
|
Author |
Message |
Gunapala CN
New User
Joined: 13 Oct 2016 Posts: 16 Location: India
|
|
|
|
Hi Folks,
I've file like below :
Code: |
SGCD 1.5 3.4 6.7
SGCD 2.5 3.6 6.7
F1CG 1.2 3.4 4.5
G1GH 1.5 2.5 6.7
F1CG 3.4 4.5 6.1 |
Here Key is First 4 letters/length: As per understanding when use SUM FIELDS=NONE it will delete second instance of duplicate record but its not true always ppl says since there few productions scenarios have been failed it seems.
hence i jsut wanted to know whats your view on this ? could you please help me to get better understanding.
Thanks
Gunapal |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
adding an OPTION EQUALS ???
to do the SUM sort needs to sort the input files
OPTION EQUALS will keep the equal keys in the sequence they were found in the input dataset |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
there few productions scenarios have been failed it seems
|
Do you have an example of any such instance? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3048 Location: NYC,USA
|
|
|
|
Look here for more alternative along with whats being said plus you can add sequence number and restart for each unique combination and use include to get which of the duplicate you want in OUTFIL, SELECT operator |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you are SORTing the data anyway (you need to with what you have shown) you can make the results consistent (a "stable sort" is the technical term for preserving the input order in the case of duplicate keys) by using OPTION EQUALS or specifying EQUAL on the SORT command, as enrico has indicated. No need to do anything else.
With SUM FIELDS=NONE the first record of which there are duplicate keys is retained. For a stable sort, that first record will always be the first record of that key from the input file.
If you specify EQUALS, there is some overhead, because a sequence number (a big one) is always made the most minor part of the sort key. So only use EQUALS when you need it.
"stable sort" doesn't imply anything "unstable", it just means the output is guaranteed reproducible. At a cost.
In a sort which is not stable, the most convenient record at the time will be the one which will be output in the case of duplicate keys. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Not a JCL/VSAM query. In fact sort/Icetool was explicitly mentioned so how you managed to post in the wrong part of the forum is ...
Topic moved. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
I was assuming the "delete" in itself is not happening when the OP said it "failed" in production. Or is he just complaining about the second record not getting deleted always! |
|
Back to top |
|
|
|