Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is it possible to skip or handle duplicate key value

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Is it possible to skip or handle duplicate key value
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Nov 16, 2011 4:21 pm    Post subject: Reply to: Is it possible to skip or handle duplicate key val
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Nov 16, 2011 7:20 pm    Post subject: Reply to: Is it possible to skip or handle duplicate key val
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    Post subject:
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: 578
Location: USA

PostPosted: Wed Nov 16, 2011 8:28 pm    Post subject:
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

Site Director


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

PostPosted: Wed Nov 16, 2011 8:30 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Thu Nov 17, 2011 11:08 am    Post subject:
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

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Nov 17, 2011 1:12 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts why i need hit enter after EXECIO * D... jackzhang75 CLIST & REXX 10 Fri May 20, 2016 9:16 pm
No new posts how to find the duplicate list RAVIGUPTA1990 DB2 6 Wed Mar 30, 2016 12:11 am
No new posts How to handle AISS abend ? robin ma 2015 CICS 1 Mon Nov 09, 2015 1:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us