I read in forum about such problem of matching & non matching could be done with SPLICE but I have not seen Matching & non matching 4 keys example like my problem & I checked sort tricks but could not figure out solution.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
rj007.
SPLICE with multiple keys is just like SPLICE with one key except that you use multiple ON fields for the multiple keys, e.g.
ON(1,5,CH) ON(9,6,CH) ...
If you want more specific help, you need to explain the "rules" for going from input to output. It's not clear if the record in output file2 is from input file1 or input file2. You need to put something in the records for your example that indicates which file a record comes from and you need to explain which input records go to which output files and why. Also, give the RECFM of the input files, and the starting position of each field.
(Records from File 1 that matched with File 2 on all Field 1, Field2, Field 3, Field 4):
Code:
12345 AAAAAA 1 12345
12346 BBBBBB 1 12345
12346 BBBBBB 2 12345
12346 BBBBBB 3 12345
12346 BBBBBB 4 12345
Output file 2:
(Records from File 1 has no matched with File 2 on any of Field 1, Field2, Field 3, Field 4):
Code:
12347 BBBBBB 1 12345
Output file 3:
(Records from File 2 has no matched with File 1 on any of Field 1, Field2, Field 3, Field 4):
Code:
12345 AAAAAA 1 12345
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It's still not clear what you want.
You say
Quote:
File 2 can contain dups on any of these keys
Does that mean that File1 cannot contain dups on the keys?
You show:
Quote:
Output file 3:
(Records from File 2 has no matched with File 1 on any of Field 1, Field2, Field 3, Field 4):
Code:
12345 AAAAAA 1 12345
but this record matches all of the fields in the first record of file1. You happen to have two of these records in file2, but they both match the first record in file1. It's not clear how you want to match these dups in file2 with the records in file1. For example what would you want for output if you had the following in file1 and file2: