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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to replace data of one file with data of another file
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: 2276
Location: @my desk

PostPosted: Wed Jul 11, 2012 12:55 pm    Post subject:
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: 788
Location: Chennai, India

PostPosted: Wed Jul 11, 2012 12:55 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Jul 11, 2012 1:23 pm    Post subject: Reply to: How to replace data of one file with data of anoth
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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