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

How to replace data of one file with data of another file


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

New User


Joined: 11 Jul 2012
Posts: 1
Location: India

PostPosted: Wed Jul 11, 2012 12:05 pm
Reply with quote

Hi

I have FILE1 with 19K records . I extract 72 records from the main file and do special processing on those records and have the 72 records ready with same key but different data in another file.

Now i want to replace the 72 records of the master file with the 72 records of the new file , whereas the other records in the Master file should be retained. Only the 72 records which got changed should be replaced .

FYI , there are no duplicates in both the files, it is a FB


Ex : ( a simple example to illustrate the scenario )

The 6 digit no acts as a key .
FIle 1 :

916734 Jawahar Nehru
916839 Jawahar Pandit

File 2 :

916374 Sanjay Kumar

O/p file expected : ( one file should have both the data )

916374 Sanjay Kumar
916389 Jawahar Pandit
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jul 11, 2012 12:55 pm
Reply with quote

Archana B,

Welcome to the forums icon_smile.gif !..You can very well achieve this using your sort product

Here is an example using Syncsort which works for your sample input (I have modified your FILE1 input key guess you have typo there). You can modify it as per your actual file attributes.
Code:
//STEP01   EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD *                                         
916374 Jawahar Nehru                                   
916839 Jawahar Pandit                                   
//SORTJNF2 DD *                                         
916374 Sanjay Kumar                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
 JOINKEYS FILE=F1,FIELDS=(1,6,A)                       
 JOINKEYS FILE=F2,FIELDS=(1,6,A)                       
 JOIN UNPAIRED,F1                                       
 REFORMAT FIELDS=(F1:1,80,F2:8,20)                     
 INREC IFOUTLEN=80,                                     
       IFTHEN=(WHEN=(81,1,CH,NE,C' '),OVERLAY=(8:81,20))
 SORT FIELDS=COPY       
SORTOUT had
Code:
916374 Sanjay Kumar   
916839 Jawahar Pandit                               
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Wed Jul 11, 2012 12:55 pm
Reply with quote

Does File 2 have 72 records, as per your scenario?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 11, 2012 1:23 pm
Reply with quote

Does file one only have 72 records? I assume not, so remember to include the record-type in the key. Are both files in key order (including record-type for file one)? If so you can reduce resource usage by specifying SORTED on the JOINKEYS for one or both files.
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 8
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 Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top