SORT Matching records to one file and nonmatching to other
I have a similar kind of problem
I have two files with 3 variables VAR1, VAR2, VAR3
I have to compare 2 files with VAR1
if they match it should copy records from File1 into file3
and if they do not match it should copy records from file1 to file3 but the variable VAR3 should be copied from file2
Show an example of the records in each input file and what you expect for output. If input file1 has duplicates within it, show that in the example. If input file2 has duplicates within it, show that in the example.
Give the starting position, length and format of all relevant fields in each file.
then the record should be copied from file1 to file 3 (output file) and replace a few fields with values from file2. The fields that need to copied from File 1 is from Position 1 to 35 and again from 60 to end of the file.
From file 2, copy fields from position 36 to 59.
i.e. For the data that I've given above, only 5 records should be present on the o/p file. sample o/p for first matching record is given below
But you only show one of these file1 records in output (it appears to be the first instance from file1). Why not both?
You need to explain what exactly you want to do when there are duplicate records within file1, and when there are duplicate records within file2, for all matching and non-matching cases. Adding examples of the input and output records for these cases to your original example would help.