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

Copy the data of only one field from one file to other


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

New User


Joined: 19 Apr 2007
Posts: 39
Location: Chennai

PostPosted: Tue May 22, 2007 4:09 pm
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue May 22, 2007 4:16 pm
Reply with quote

Shrimathi Krishnan,

If you could elaborate your requirement, we may be in a position to help you
Back to top
View user's profile Send private message
Shrimathi Krishnan

New User


Joined: 19 Apr 2007
Posts: 39
Location: Chennai

PostPosted: Tue May 22, 2007 4:21 pm
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue May 22, 2007 4:33 pm
Reply with quote

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
View user's profile Send private message
Shrimathi Krishnan

New User


Joined: 19 Apr 2007
Posts: 39
Location: Chennai

PostPosted: Tue May 22, 2007 4:39 pm
Reply with quote

f33 is file aid option for copy.
What if both of my files are different in theri layouts?
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Canada

PostPosted: Tue May 22, 2007 4:43 pm
Reply with quote

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
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue May 22, 2007 4:44 pm
Reply with quote

Please provide the layouts of the both the files.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue May 22, 2007 11:47 pm
Reply with quote

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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top