IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to delete second instance from Flat file in SORT/IceTool


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gunapala CN

New User


Joined: 13 Oct 2016
Posts: 16
Location: India

PostPosted: Tue Oct 18, 2016 11:42 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Oct 19, 2016 12:27 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 19, 2016 1:35 am
Reply with quote

Quote:
there few productions scenarios have been failed it seems
Do you have an example of any such instance?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Oct 19, 2016 2:06 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 19, 2016 3:29 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Oct 19, 2016 3:52 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Oct 20, 2016 2:58 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts DELETE SPUFI DB2 1
Search our Forums:

Back to Top