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

Remove Duplicates with SUM FIELDS=NONE


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sarav_cit

New User


Joined: 20 Nov 2006
Posts: 5
Location: Chennai

PostPosted: Sat Aug 25, 2012 12:41 am
Reply with quote

I am using SORT utility, have a question on removing duplicates using SUM FIELDS=NONE, it may be a simple solution but I dont know.

Our requirement is to keep only the latest record when merging previous day's file with today's file, but there is no date or time stamp in the file, that is the problem I am facing... here is my SORT Jcl.

Code:
//SORT020   EXEC PGM=SORT                               
//SYSIN     DD *                                       
   SORT FIELDS=(1,9,CH,A)                               
   SUM FIELDS=NONE                                     
//SORTIN    DD DSN=INPUT.FILE1.YDAY
//               DD DSN=INPUT.FILE2.TODAY
//SORTOUT   DD DSN=OUTPUT.FILE, 


If there is any duplicate record on the key I specified, the record from today's file should be kept and another one should be removed.

I tried testing the above JCL with test data, but there is not definite answer, and the results are not consistent.
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: Sat Aug 25, 2012 12:51 am
Reply with quote

Look at your documentation for EQUALS - this will allow you to retain the same order on "output" from the sort as the records were on "input", when the keys are equal.

If you then "turn around" your concatenation, so that "today" is first, that might give you a start.

If you have multiple records on "today's" file, which would you want to keep?
Back to top
View user's profile Send private message
sarav_cit

New User


Joined: 20 Nov 2006
Posts: 5
Location: Chennai

PostPosted: Sat Aug 25, 2012 1:31 am
Reply with quote

My today's file will not have any duplicates...

I dont have any documentation on SORT, can you provide me if you have any? or tell me what do you mean by EQUALS?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 25, 2012 1:46 am
Reply with quote

sarav_cit,

.x.x.x.x.x. (consider that my normal rant about posters such as you).

if you were to look at the DFSORT documentation about EQUALS,
you will get your answer,
it functions the same way in syncsort.

syncsort documentation is available at the manufacture's website,
if your site is an authorized client.

if you were to google,
you can find that there are many syncsort 'partial' documents available on the web,
as well as discussions/papers concerning the subject.

members will attempt to expand your knowledge/understanding
after you have made an attempt to read the documentation.
members do not like to quote sections of available documentation.
Back to top
View user's profile Send private message
sarav_cit

New User


Joined: 20 Nov 2006
Posts: 5
Location: Chennai

PostPosted: Sat Aug 25, 2012 3:35 am
Reply with quote

Thanks everyone for your help !!

We dont use SORT much in our projects, most of the people here dont know much about SORT utility, that's why I ask these stupid questions... sorry about that...
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Aug 25, 2012 3:47 am
Reply with quote

you are welcome.

even syncsort is a very good tool and underutilitized.
(sorry Allissa, I am true blue and consider Frank (now gone) and Kolusu
developers of an excellent product).

sarav_cit,
find some documentation.

Search thru the JCL forum for older (2011/2010) posts
and find Allissa's email address.
(there is another syncsort rep that occasions the forum, also)
She and her team can/will increase your department's SORT capabilities
and will provide you with documentation,
if you do not have it on site.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Aug 27, 2012 11:58 am
Reply with quote

Hello,

As Bill's suggestion on EQUALS, simple search would have helped you better.

If you have still issues, try the snippet below,

Code:
//STEP01    EXEC PGM=SORT           
//SORTIN    DD *                   
12345 - TODAYS FILE                 
12345 - YESTER FILE                 
23456 - TODAYS FILE                 
99999 - TODAYS FILE                 
99999 - YESTER FILE                 
//SORTOUT   DD SYSOUT=*             
//SYSIN     DD *                   
  SORT FIELDS=(1,5,FS,A),EQUALS     
  SUM FIELDS=NONE 


Output:
Code:
12345 - TODAYS FILE
23456 - TODAYS FILE
99999 - TODAYS FILE
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Pull data using date difference betwe... DB2 6
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
Search our Forums:

Back to Top