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

Elimate the duplicate record using SYNCSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Sat Jan 17, 2009 11:18 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sun Jan 18, 2009 2:00 pm
Reply with quote

Have you read the manual to see what SUM FIELDS might do
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 10:00 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 19, 2009 10:16 am
Reply with quote

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
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 11:00 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 19, 2009 11:08 am
Reply with quote

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 icon_wink.gif

Good luck and i'll continuing to look for a single-pass alternative icon_smile.gif

d
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 11:22 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jan 19, 2009 11:37 am
Reply with quote

sumueng,

Do you have more than 2 duplicates in your input? Which record you want in the output in this case?
Back to top
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 11:54 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jan 19, 2009 11:57 am
Reply with quote

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
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 12:06 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jan 19, 2009 12:52 pm
Reply with quote

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
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 1:27 pm
Reply with quote

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
View user's profile Send private message
sumueng

New User


Joined: 27 Nov 2008
Posts: 37
Location: Cochin

PostPosted: Mon Jan 19, 2009 3:54 pm
Reply with quote

Thanks for all your suggestion and tips. The duplicate record issue is resolved
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jan 19, 2009 3:58 pm
Reply with quote

sumueng,

You're welcome. icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top