View previous topic :: View next topic
|
Author |
Message |
sarav_cit
New User
Joined: 20 Nov 2006 Posts: 5 Location: Chennai
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sarav_cit
New User
Joined: 20 Nov 2006 Posts: 5 Location: Chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
sarav_cit
New User
Joined: 20 Nov 2006 Posts: 5 Location: Chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
xknight
Active User
Joined: 22 Jan 2008 Posts: 117 Location: Liberty city
|
|
|
|
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 |
|
|
|