Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Ignore duplicate while copying

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Ignore duplicate while copying
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

Active Member


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

PostPosted: Wed Apr 01, 2009 7:48 pm    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Wed Apr 01, 2009 8:01 pm    Post subject:
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    Post subject:
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    Post subject:
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: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Thu Apr 02, 2009 5:08 pm    Post subject:
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    Post subject: Reply to: Ignore duplicate while copying
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts copying data without knowing location Arun Raj DFSORT/ICETOOL 12 Thu Jul 20, 2017 1:03 pm
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Copying Panvalet members to PDS LOGESHWARAN K CA Products 4 Mon Mar 06, 2017 10:45 am
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us