Could you please help me in getting the desired output.
Explanation:
The records from the file-1 will be placed first and below that the file-2 will be placed. The output file should have matching records from both the files by overlaying the records from the file-2. If the file-1 has 1 record and the file-2 has 2 records of similar key then the output will be written as first record from the file-2(as overlaid) and second record again from the file-2 as it has got only 1 record in the file-1 and so on will occur for rest of the records. The output will also have the non-matching records from the file-1 i.e. the records which are present only in file-1 and not in file-2.
The length of each field DEPT, LOC and SAL can be assumed as 10 bytes. Input files can have RECFM=FB and LRECL=80,
Please refer to the below output structure for more clarity.
Thanks in advance
Code: Select all
Input:
File-1
DEPT LOC SAL
001 USA 1000
001 BRA 2000
002 ARG 3000
003 CAN 4000
004 CHI 5000
004 IND 6000
004 NEP 7000
004 JPN 8000
005 AUS 9000
File-2
DEPT LOC SAL
001 UK 1001
002 HOL 2002
002 SWI 3003
004 GER 4004
005 FRA 5005
005 BEL 6006
005 CRO 7007
005 ITL 8008
Output:
DEPT LOC SAL
001 UK 1001
001 BRA 2000
002 HOL 2002
002 SWI 3003
003 CAN 4000
004 GER 4004
004 CHI 5000
004 IND 6000
004 NEP 7000
004 JPN 8000
005 FRA 5005
005 BEL 6006
005 CRO 7007
005 ITL 8008
006 ANT 9100