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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to delete second instance from Flat file in SORT/IceTool
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10272
Location: italy

PostPosted: Wed Oct 19, 2016 12:27 am    Post subject: Reply to: How to delete second instance from Flat file in SORT/IceTool
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: 2278
Location: @my desk

PostPosted: Wed Oct 19, 2016 1:35 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1720
Location: NY,USA

PostPosted: Wed Oct 19, 2016 2:06 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Oct 19, 2016 3:29 am    Post subject: Reply to: How to delete second instance from Flat file in SORT/IceTool
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: 1806
Location: UK

PostPosted: Wed Oct 19, 2016 3:52 am    Post subject:
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: 2278
Location: @my desk

PostPosted: Thu Oct 20, 2016 2:58 am    Post subject: Reply to: How to delete second instance from Flat file in SORT/IceTool
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    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 REXX - Dynamic file Creation d_sarlie CLIST & REXX 6 Tue Jun 27, 2017 7:30 pm
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 4 Mon Jun 26, 2017 11:15 pm
No new posts FTP xls file from Mainfrmae kumarsatheeshc1 TSO/ISPF 5 Tue Jun 20, 2017 6:56 pm
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


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