1) Position No 6 to 15 (length = 10) in the first file should have the value =
Position no 23 to 32 ( in File 2 ) where the first 3 bit were always 555 and 14 th 16 cols are AAA.
2) There are duplicate keys (i.e 6 th to 15th ) in File 1 are there. So we should consider only one for each(e.g 1234) consider the first occurance of pos (23 to 32 ) where first three bits are 555 and the 1th to 16th are AAA. in file 2.
3) Simillarly for the second one in the file 2 we should get the second occurance in the file 2.
If we did not got the key value for the first key (File 1) in the first occurance in File 2 then the first two bytes along with the Key (e.g - 541234 ) should populate in the report or else no need to write anything.
So for the current example the output file should be empty.
Your explanation is not at all clear. I can't figure out what you want. And your example with NO output records doesn't help.
Please show a better example of input and expected output illustrating each condition you describe for the case where you would get an output record and not get an output record, and explain which condition results in which output records and why. Include duplicate input records in your example where appropriate.
first 3 bit were always 555
A "bit" can only be a 0 or a 1, not a 5. Do you mean the first 3 characters?