OFS = Output Field Separator
This will not help you in the case where you are reading the file in. What I mean by record separator is the RS variable which will allow you to say where a complete record ends, in your case
that each record should start with 01 at the start of the line.
Code:
valid_tender_field in valid_tender_type
valid_tender_type is not an array, so I would be dubious on how this part of your 'if' would work??
I also note, that at no time do you reset your variables, hence the previous '07' line value will still be set when the next '01' is hit and so the test will still be true.
In fact, as you never rest it, once you hit your desired scenario once, it will always be true.