I have 3 file. Main file <File 1>, Reference File A <File 2> and B <File 3>.
- There may or may not exist a Matching ID and Mailing Address in each reference file.
- For each matching ID and Mailing address from reference file A and B, the set of records have to be "moved" to the main file right after the matching record of MAIN file.
- The reference file A and B should have all its matched records removed.
The output files expected are shown here as <Result File 4>,<Result File 5> and <Result File 6>.
Any help will be appreciated.
<FILE 1:> MAIN FILE.
================================================================================
RECORD1
RECORD1 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD1 ID# 0011223344
RECORD1
RECORD2
RECORD2 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD2 ID# 0022334411
RECORD2
RECORD3
RECORD3 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD3 ID# 0033441122
RECORD3
RECORD4
RECORD4 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD4 ID# 0044112233
RECORD4
================================================================================
<FILE 2:> REFERENCE FILE A
==============================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:BMW
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0022334411
DESCRIPTION:HONDA
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441155
DESCRIPTION:TOYOTA
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0044112233
DESCRIPTION:FORD
===============================
<FILE 3:> REFERENCE FILE B
===============================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:Z3
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441122
DESCRIPTION:TT
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 1122334455
DESCRIPTION:MERCEDEZ
===============================
<RESULT FILE 4:> UPDATED MAIN FILE.
================================================================================
RECORD1
RECORD1 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD1 ID# 0011223344
RECORD1
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:BMW
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:Z3
RECORD2
RECORD2 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD2 ID# 0022334411
RECORD2
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0022334411
DESCRIPTION:HONDA
RECORD3
RECORD3 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD3 ID# 0033441122
RECORD3
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441122
DESCRIPTION:TT
RECORD4
RECORD4 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD4 ID# 0044112233
RECORD4
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0044112233
DESCRIPTION:FORD
================================================================================
<RESULT FILE 5:> NEW REFERENCE FILE A WITH NON-MATCHED RECORDS
==================================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441155
DESCRIPTION:TOYOTA
==================================
<RESULT FILE 6:> NEW REFERENCE FILE B WITH NON-MATCHED RECORDS
==================================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 1122334455
DESCRIPTION:MERCEDEZ
==================================
- There may or may not exist a Matching ID and Mailing Address in each reference file.
- For each matching ID and Mailing address from reference file A and B, the set of records have to be "moved" to the main file right after the matching record of MAIN file.
- The reference file A and B should have all its matched records removed.
The output files expected are shown here as <Result File 4>,<Result File 5> and <Result File 6>.
Any help will be appreciated.
<FILE 1:> MAIN FILE.
================================================================================
RECORD1
RECORD1 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD1 ID# 0011223344
RECORD1
RECORD2
RECORD2 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD2 ID# 0022334411
RECORD2
RECORD3
RECORD3 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD3 ID# 0033441122
RECORD3
RECORD4
RECORD4 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD4 ID# 0044112233
RECORD4
================================================================================
<FILE 2:> REFERENCE FILE A
==============================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:BMW
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0022334411
DESCRIPTION:HONDA
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441155
DESCRIPTION:TOYOTA
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0044112233
DESCRIPTION:FORD
===============================
<FILE 3:> REFERENCE FILE B
===============================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:Z3
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441122
DESCRIPTION:TT
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 1122334455
DESCRIPTION:MERCEDEZ
===============================
<RESULT FILE 4:> UPDATED MAIN FILE.
================================================================================
RECORD1
RECORD1 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD1 ID# 0011223344
RECORD1
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:BMW
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0011223344
DESCRIPTION:Z3
RECORD2
RECORD2 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD2 ID# 0022334411
RECORD2
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0022334411
DESCRIPTION:HONDA
RECORD3
RECORD3 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD3 ID# 0033441122
RECORD3
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441122
DESCRIPTION:TT
RECORD4
RECORD4 MAILING NAME MAILING ADDRESS 1 MAILING ADDRESS 2
RECORD4 ID# 0044112233
RECORD4
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0044112233
DESCRIPTION:FORD
================================================================================
<RESULT FILE 5:> NEW REFERENCE FILE A WITH NON-MATCHED RECORDS
==================================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 0033441155
DESCRIPTION:TOYOTA
==================================
<RESULT FILE 6:> NEW REFERENCE FILE B WITH NON-MATCHED RECORDS
==================================
1
-
0 MAILING NAME
MAILING ADDRESS 1
MAILING ADDRESS 2
- ID# 1122334455
DESCRIPTION:MERCEDEZ
==================================