View previous topic :: View next topic
|
Author |
Message |
Shrimathi Krishnan
New User
Joined: 19 Apr 2007 Posts: 39 Location: Chennai
|
|
|
|
Hi
I have two vsam files and i need to copy the data of only one field from one file to other. Is there a way to do that? |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Shrimathi Krishnan,
If you could elaborate your requirement, we may be in a position to help you |
|
Back to top |
|
|
Shrimathi Krishnan
New User
Joined: 19 Apr 2007 Posts: 39 Location: Chennai
|
|
|
|
Hi
I have two VSAM files. I need the data from one file to be copied to other. If i want to copy the whole file i can use 9f33 option. But i need to copy only one field data to my another file.
For eg
Flie1 has the fields cusno orderno and ownerid
File 2 has the fields cusno partno and secureid
The data are different in both the files
Now i want only the cusno of file2 to be copied in cusno of file1
Hope am clear. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Shrimathi Krishnan,
Quote: |
If i want to copy the whole file i can use 9f33 option. |
What is it?
If your shop has DFSORT, use the following with few modifications as per your layout -
Code: |
//VSAMCOPY EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=FILE2,DISP=SHR assumption lrecl=80,recfm=fb
//SORTOUT DD DSN=FILE1,DISP=MOD layout similar to FILE1
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1,5, * assumption CUSNO starts @1 length 5
80:C' ')
/* |
|
|
Back to top |
|
|
Shrimathi Krishnan
New User
Joined: 19 Apr 2007 Posts: 39 Location: Chennai
|
|
|
|
f33 is file aid option for copy.
What if both of my files are different in theri layouts? |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
There can be many ways ,one of them is
I assume cusno as unique key in both the VSAM
A simple COBOL program will do it.
Open file 1 in I-O and file 2 in input mode.
Read both the files based on the cusno ,though they are VSAMs read them sequentially and compare
If file1.cus-no =file2.cusno
Read file1,file2
Else IF file1.cusno > file2.cusno
Write Record from file2
Read file 2
Else If file1.cusno < file2.cusno
Read file1 |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Please provide the layouts of the both the files. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
For you to get usable suggestions, it would be a good idea to post a few records from each file and what the output of this process will be.
Your test tada needs to show what happens when the "same" key is in both files and when it is present in one file but not the other.
Your output file should show the data after the process completes. |
|
Back to top |
|
|
|