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

Ignore duplicate while copying


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

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Apr 01, 2009 7:32 pm
Reply with quote

Hi,

I have two VSAM file
Code:
File A:               File B:
101                   101
102                   102
104                   103
106                   105
108                   106


I want to copy the data from file A to file B, but while copying the duplicate records which is already present in the file B, like 101, 102 & 106 should now be written again to the file.
Could you please help how to achieve this.

Thanks
Nirmal
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Wed Apr 01, 2009 7:48 pm
Reply with quote

Do you mean to overwrite the contents of record 101,102,106 in FileB with details from FileA or do you want to have both records in FileB? If the former, use ICETOOL and keep FIRSTDUP. If the latter, just concatenate the files as SORTIN into your sort.

Garry.
Back to top
View user's profile Send private message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Wed Apr 01, 2009 7:53 pm
Reply with quote

I want that record 104 and 108 will be written into file B from file A, retaining the record in file B as it is.
Is it possible to use sort with VSAM file.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


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

PostPosted: Wed Apr 01, 2009 8:01 pm
Reply with quote

OK, you want both records in FileB. Concatenating the files should do the trick.

Yes, it is possible to use sort with VSAM - but what type of VSAM file? If the file is KSDS, you cannot have duplicate keys.

Garry.
Back to top
View user's profile Send private message
r2k1984

New User


Joined: 21 Jun 2005
Posts: 69
Location: chennai

PostPosted: Thu Apr 02, 2009 12:49 pm
Reply with quote

Hey it is simple..

merge step : give the frist dd as b file and second file as a file and remove the duplicate record with equals option in sum.

First record for the key only will be displayed. Else it wont display.

It will work try it
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Apr 02, 2009 4:48 pm
Reply with quote

r2k1984
Is it possible to concatenate the VSAM file's in DD statements ?
Quote:
merge step : give the frist dd as b file and second file as a file and remove the duplicate record with equals option in sum.

OPTION EQUALS will not remove duplicates. To remove duplicates , you need to use SUM FIELDS=NONE

kedianirmal
Try the below ICETOOL solution
[code]//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILEB
//IN2 DD DSN=FILEA
//TMP1 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//OUT DD DSN=FILEB
//TOOLIN DD *
COPY FROM(IN1) TO(TMP1)
COPY FROM(IN2) TO(TMP1)
SELECT FROM(TMP1) TO(OUT) ON(1,3,CH) FIRST
/*
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Apr 02, 2009 5:08 pm
Reply with quote

VSAM files cannot be concatenated. See section 3.6.3 of the DF/SMS Using Data Sets manual for the rule.
Back to top
View user's profile Send private message
subinraj

New User


Joined: 04 Sep 2007
Posts: 16
Location: Bangalore

PostPosted: Thu Apr 02, 2009 8:33 pm
Reply with quote

Try the following

DD1 : IPHT.TEST.VSAM.DD1
Code:
ACUPA111           fi l1
ACUPA333           fi l1
ACUPA555           fi l1
ACUPA777           fi l1


DD2 : IPHT.TEST.VSAM.DD2
Code:
ACUPA111           fi l2
ACUPA222           fi l2
ACUPA333           fi l2


Code:
//COPY01   EXEC PGM=IDCAMS,REGION=4M       
//SYSPRINT DD  SYSOUT=*                   
//SYSOUT   DD  SYSOUT=*                   
//SYSUDUMP DD  SYSOUT=*                   
//DD1   DD DSN=IPHT.TEST.VSAM.DD1,DISP=SHR
//DD2   DD DSN=IPHT.TEST.VSAM.DD2,DISP=SHR
//SYSIN DD  *                             
  REPRO INFILE(DD1) OUTFILE(DD2) REPLACE



Output - After running the job (IPHT.TEST.VSAM.DD2)
Code:
ACUPA111           fi l1
ACUPA222           fi l2
ACUPA333           fi l1
ACUPA555           fi l1
ACUPA777           fi l1


Here the input files should be VSAM and in my case the keys are the first 8 bytes.[/code]
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 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 Panvalet - 9 Character name - Issue c... CA Products 6
Search our Forums:

Back to Top