View previous topic :: View next topic
|
Author |
Message |
Prosenjit001
New User
Joined: 02 Nov 2011 Posts: 14 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Lots of examples here of loosing duplicates. Search forum for SUM, maybe? |
|
Back to top |
|
|
Prosenjit001
New User
Joined: 02 Nov 2011 Posts: 14 Location: India
|
|
|
|
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..... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Prosenjit001
New User
Joined: 02 Nov 2011 Posts: 14 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
but I have to run the jobs for several times ... |
Why
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
|