View previous topic :: View next topic |
Author |
Message |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Thu Feb 16, 2017 9:46 am Post subject: Merge the two files. |
|
|
Hi,
I want to merge below two files as show below. Can you please help with the sort card.
Input file1
Code: |
****** ***************************** Top of Data ******************************
000001 2017-02-14 AAAA
000002 2017-02-15 BBBB
****** **************************** Bottom of Data ****************************
|
Input file2
Code: |
****** ***************************** Top of Data ******************************
000001 2017-02-14 CCCC
000002 2017-02-15 DDDD
000003 2017-02-16 EEEE
000004 2017-02-17 FFFF
****** **************************** Bottom of Data ****************************
|
Output file
Code: |
****** ***************************** Top of Data ******************************
000001 2017-02-14 AAAA CCCC
000002 2017-02-15 BBBB DDDD
000003 2017-02-16 EEEE
000004 2017-02-17 FFFF
****** **************************** Bottom of Data ****************************
|
Thanks,
Siva |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Thu Feb 16, 2017 12:03 pm Post subject: |
|
|
sivafdms,
Use Joinkeys function to match on the date field.
1. As the data seems to be already sorted, use the date field as a key and code sorted, noseqck
2. Use JOIN UNPAIRED to get both matches and unmatched records.
3. Use REFORMAT statement to pick the values from the different files. _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Fri Feb 17, 2017 5:18 am Post subject: |
|
|
Thanks Kolusu!! It worked, it was so simple. I was thinking we need complex operations to do this. Also learned new option noseqchk. |
|
Back to top |
|
|
|
|