View previous topic :: View next topic
|
Author |
Message |
Archana B
New User
Joined: 11 Jul 2012 Posts: 1 Location: India
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Archana B,
Welcome to the forums !..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 |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Does File 2 have 72 records, as per your scenario? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|