Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Copy the data of only one field from one file to other
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: 1439
Location: Bangalore,India

PostPosted: Tue May 22, 2007 4:16 pm    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Tue May 22, 2007 4:33 pm    Post subject:
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    Post subject:
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: Chennai

PostPosted: Tue May 22, 2007 4:43 pm    Post subject: Re: to copy one field alone
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: 1439
Location: Bangalore,India

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

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

Site Director


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

PostPosted: Tue May 22, 2007 11:47 pm    Post subject:
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    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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us