MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare Two Files and Merge the Column Values

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Dinesh Kumar
Beginner


Joined: 12 Oct 2004
Posts: 13
Topics: 6

PostPosted: Mon Mar 07, 2011 9:44 am    Post subject: Compare Two Files and Merge the Column Values Reply with quote

The first 10 bytes represents the Key field. If there is an entry in file1 and also present in File2 on the basis of the
key field that should be captured in the output file.

The "City" column data from file2 should be concatenated and merged with the File1 data as stated below .
Note:File2 has City column as "AAAA" for "1111111111" which already exists in File2 hence that value shouldn't be concatenated again

Is this possible using a single sort step?


File1:
Code:


KeyField   City
----+----1----+----2----+----3----+----4----+----5
1111111111 AAAA                               
1111111111 BBBB                               
2222222222 CCCC                               
3333333333 DDDD         
3333333333 DDDD     

File2:
Code:

Keyfield   City
----+----1----+----2----+----3----+----4----+----5
1111111111 XXXX                               
1111111111 AAAA                               
1111111111 EEEE     
3333333333 ZZZZ                   
4444444444 UUUU       
4444444444 VVVV       


Output File:
Code:


Keyfield   City
----+----1----+----2----+----3----+----4----+----5
1111111111 AAAA  XXXX  EEEE                           
1111111111 BBBB  XXXX  AAAA  EEEE                           
3333333333 DDDD  ZZZZ       
3333333333 DDDD  ZZZZ   

_________________
Thanks & Rgds
Dinesh
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Mar 07, 2011 11:27 am    Post subject: Reply with quote

Dinesh Kumar,

If both files are of the same LRECL and RECFM , concatenate both files and remove the dupes (sort fields = (key field + city) with SUM Fields= NONE and then use the OUTREC grouping method shown in your earlier topic

http://www.mvsforums.com/helpboards/viewtopic.php?p=57584#57584
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group