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
 

 

Removing duplicates using SUM FIELDS=NONE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: Removing duplicates using SUM FIELDS=NONE
Reply with quote

Hi,
I am not an expert in 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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Sat Aug 25, 2012 12:51 am    Post subject: Reply to: SYNCSORT:Quest on Removing duplicates using SUM FI
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    Post subject: Reply to: SYNCSORT:Quest on Removing duplicates using SUM FI
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    Post subject:
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    Post subject: Reply to: SYNCSORT:Quest on Removing duplicates using SUM FI
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am


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