View previous topic :: View next topic
|
Author |
Message |
Tato11
New User
Joined: 09 Feb 2023 Posts: 1 Location: Italy
|
|
|
|
Hello, I state that I do not speak English well, I have 2 input datasets that have the same first field, I should merge the 2 datasets into a single one and align the records based on the first field, remove the duplicates from the first field due to the second field and put the doubles of the second field all on one line separated by the '-' character. For example:
Code: |
FILE IN 1:
AAAAAAAA AA XXXXX XXXXX
AAAAAAAA TT XXXXX XXXXX
AAAAAAAA YY XXXXX XXXXX
BBBBBBBB BB QQQQQ QQQQQ
CCCCCCCC CC RRRRR RRRRR
CCCCCCCC II RRRRR RRRRR
CCCCCCCC OO RRRRR RRRRR
DDDDDDDD DD YYYYY YYYYY
EEEEEEEE EE MMMMM MMMMM
FFFFFFFF FF UUUUU UUUUU
FILE IN 2:
AAAAAAAA WWWWWW TTTTTTT
CCCCCCCC OOOOOO IIIIIII
EEEEEEEE ZZZZZZ NNNNNNN
FFFFFFFF KKKKKK LLLLLLL
FILE OUTPUT:
AAAAAAAA AA-TT-YY XXXXX XXXXX WWWWWW TTTTTTT
BBBBBBBB BB QQQQQ QQQQQ
CCCCCCCC CC-II-OO RRRRR RRRRR OOOOOO IIIIIII
DDDDDDDD DD YYYYY YYYYY
EEEEEEEE EE MMMMM MMMMM ZZZZZZ NNNNNNN
FFFFFFFF FF UUUUU UUUUU KKKKKK LLLLLLL
|
Could you help me with this case? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2127 Location: USA
|
|
|
|
There are tons of ways to do this merge.
The simplest method is - using the DFSORT/SYNCSORT tool (provided the maximum number of records in a single group is reasonably limited).
Try to read something about it. There are hundreds, or thousands of working examples at this forum, and around.
Try to achieve your goal step by step, not "everything at once":
- learn how to handle duplicate records,
- learn how to reformat the output records,
- learn how to join two input streams,
- learn how to combine all those tricks together. P.S.
Using SORT facility is not related in any manner to the use of JCL features. |
|
Back to top |
|
|
|