View previous topic :: View next topic
|
Author |
Message |
Sumeendar
New User
Joined: 31 Jan 2006 Posts: 39
|
|
|
|
Hi,
I have a query. In my file i have got two records (duplicate) with same key values (first 13 bytes). My need is to retain the second record and eliminate the first record using SYNCSORT.
Below is the sort field positions.
SORT FIELDS=(1,13,CH,A)
Let me know how can i solve my above query using SYNCSORT.
Thanks
Sumu |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Have you read the manual to see what SUM FIELDS might do |
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
Hi,
I know the use of SUM FIELDS and i have tried it out.
When we use SUM FIELDS = NONE, out of two similar key records, the record that comes first is kept and removes the second record.
But my query is that, is it possible to retain the second record and eliminate the first record, as the remaining datas (apart from key values) that comes in the second record is the latest.
I would like to know whether this is possible
Thanks
Sumeendar S |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
How large is the file?
If it is small, try using a descending sort to remove duplicates and resort that output.
Which release of Syncsort are you using? |
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
I am using SYNCSORT FOR Z/OS 1.3.1.0.
The file contains around 20, 000 records. Is it possible with this set of records.
So you are saying we have to use two sort cards. One using descending sort along with SUM FIELDS = NONE to remove duplicate and then use another sort card resort the above the set of records.
Let me know if this is what you meant. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
So you are saying we have to use two sort cards. One using descending sort along with SUM FIELDS = NONE to remove duplicate and then use another sort card resort the above the set of records.
|
Yes, i believe this would do what you want.
I do not have most of the current Syncsort info with me this weekend - there may be a more elegant way using Syncsort 1.3. I'd prefer one pass of the thata rather than 2
Good luck and i'll continuing to look for a single-pass alternative
d |
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
Okay fine. Let me know if you find any possible way to solve the issue.
In meantime i will try from my side too. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
sumueng,
Do you have more than 2 duplicates in your input? Which record you want in the output in this case? |
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
These are my duplicate records (key fields is 1 to 13 bytes) from the input file having record length 3635.
ILHBN04861Z00 060308
ILHBN04861Z00 123108
From the above set of records i need to retain the highlighted record and eliminate the other record.
I tried few option like using Descending sort but didn't work out.
Let me know if it is possible |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
Let me know if it is possible |
sumueng,
We can provide some useful suggestions only if you help us by answering the questions asked here.
Quote: |
Do you have more than 2 duplicates in your input? Which record you want in the output in this case? |
|
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
Let me confirm i have got only two duplicate records in which i need to retain the second record and eliminate the first record as specifed in my previous post. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
sumueng,
You can use the below SYNCTOOL job to achieve this.
Code: |
//STEP1 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN= Input file
//OUT DD DSN= Output file
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,13,CH) LAST
/* |
|
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
thanks for the tip. i executed using synctool. let me crosscheck if records have come out as expected. I will then update |
|
Back to top |
|
|
sumueng
New User
Joined: 27 Nov 2008 Posts: 37 Location: Cochin
|
|
|
|
Thanks for all your suggestion and tips. The duplicate record issue is resolved |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
sumueng,
You're welcome. |
|
Back to top |
|
|
|