View previous topic :: View next topic
|
Author |
Message |
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
kedianirmal
New User
Joined: 08 Feb 2008 Posts: 82 Location: Bangalore, India
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
r2k1984
New User
Joined: 21 Jun 2005 Posts: 69 Location: chennai
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
VSAM files cannot be concatenated. See section 3.6.3 of the DF/SMS Using Data Sets manual for the rule. |
|
Back to top |
|
|
subinraj
New User
Joined: 04 Sep 2007 Posts: 16 Location: Bangalore
|
|
|
|
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 |
|
|
|