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

Is it possible to skip or handle duplicate key value


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Prosenjit001

New User


Joined: 02 Nov 2011
Posts: 14
Location: India

PostPosted: Wed Nov 16, 2011 4:14 pm
Reply with quote

I have to copy one dataset to a vsam using sort , while coping is it possible to skip record for duplicate key . i.e. The vsam already has some data .. I want to copy into the vsam such a way that , if the copy process find data is already there into the vsam it will skip the record , otherwise it wil copy into the vsam ..
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: Wed Nov 16, 2011 4:21 pm
Reply with quote

Lots of examples here of loosing duplicates. Search forum for SUM, maybe?
Back to top
View user's profile Send private message
Prosenjit001

New User


Joined: 02 Nov 2011
Posts: 14
Location: India

PostPosted: Wed Nov 16, 2011 5:16 pm
Reply with quote

Bill , dupicates are not present in single file .. duplicates are there between input and output file ... I can use joinkays to find dulpicate between input and output and drop them from the input before the copy step ... but my question is is it possible in more simple way .. in a single sortcard ... I need to handle it otherwise job is getting down due to duplicate value..... icon_sad.gif
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: Wed Nov 16, 2011 7:20 pm
Reply with quote

I think you need to be clearer to us about what you are doing.

Are you doing sequential inserts on a VSAM KSDS using Sort?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Nov 16, 2011 8:08 pm
Reply with quote

I don't believe that you can circumvent the action taken by a WRITE when dup key exists.

i think that you will have to have to prepass the input file against the existing VSAM (your joinkeys solution),
but you have to drop not only the duplicates from the input file,
but also all the existing vsam records,
so that the result is only your input file parsed of existing keys.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Nov 16, 2011 8:28 pm
Reply with quote

Prosenjit001,
What is the LRECL/RECFM for the file which records you want to copy to VSAM? What is the field position and length of the key fields. What is the key fields/length for the KSDS along with Avg/Max. record length?

If possible, provide an example of sampe input and expected output.

Quote:
I can use joinkays to find dulpicate between input and output and drop them from the input before the copy step ... but my question is is it possible in more simple way .. in a single sortcard ...
Not sure how you define "simple way .. in a single sortcard", but it may be possible in a single sort card using JOINKEY.

Thanks,
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: Wed Nov 16, 2011 8:30 pm
Reply with quote

Hello,

You might Consider unloading the vsam file into a sequential dataset, doing a delete/define of the vsam file, then use your JOINKEYS solution to re-create the vsam file discarding duplicates.

How many recordsd are in the vsam file before your process? How many records are in the external data file to be applied to the vsam file?
Back to top
View user's profile Send private message
Prosenjit001

New User


Joined: 02 Nov 2011
Posts: 14
Location: India

PostPosted: Thu Nov 17, 2011 9:28 am
Reply with quote

The requirement is to restore a VSAM KSDS from a tape dataset ..
maximum record length of the vsam is 2000 , and the tape dataset lrecl is 2004 (in vb format) ..... after the restore step tape vsam should contains all the records from the tape dataset ... but I have to run the jobs for several times ... so each time i have to run the job , i have to delete define the vsam ... I dont want to redefine the vsam inbetween the flow ... so my question in sort is it possible to skip coping records those are already there in the vsam ... or force copy into the vsam (i.e. delete all the records from the vsam and copy all records from the dataset )
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: Thu Nov 17, 2011 11:08 am
Reply with quote

Hello,

Quote:
but I have to run the jobs for several times ...
Why icon_confused.gif

Suggest you pre-process all of the data that is not in the vsam file creating a new file to be processed. Then follow my suggestion above. Unless there is more that you haven't gotten around to posting, i see no reason to do multiple delete/define to process the data.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Nov 17, 2011 1:12 pm
Reply with quote

Quote:
dont want to redefine the vsam inbetween the flow ... so my question in sort is it possible to skip coping records those are already there in the vsam ... or force copy into the vsam (i.e. delete all the records from the vsam and copy all records from the dataset )



If you define the VSAM file with REUSE, DFSORT can be used to copy from the tape file to VSAM - there is no need to delete/define the VSAM dataset.

Garry.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
No new posts Duplicate data in PUT CONTAINER using... CICS 4
No new posts Remove set of duplicate records from ... DFSORT/ICETOOL 10
Search our Forums:

Back to Top