Welcome to the forum.
When replying to a request, it is good to have read the request and address your response to it. The TS is having trouble with the "find" part, for which you have supplied no elaboration. If you had read the contributions already made, you'd see that you add nothing to what enrico has already suggested, and, unlike him, provide no method for the "find" part.
You have gone to the bother of formatting your pseudo-code, and then not gone to the bother of preserving the formatting. Here is what your code looks like:
ronners wrote:read a record
do while not end-of-file
/* process the record */
process the fixed part
determine the position of the remainder (the variable part) of the record
do while the remainder <> spaces
find the end of the keyword=value (the next ~ char or last non-blank)
find the 'equals' sign
/* now you know where and how long your keyword and value are */
process your keyword and value
determine the position of the remainder (the variable part) of the record
end
read a record
end
This is called a read-ahead loop. You read before doing a loop, and in the loop you process the record. At the end of the loop you read the next record.
You seen there's a similar do-loop construct to process the variable part of the record. Happy coding.
If you want to see how it is done, press the Quote button on this reply. You can code the tags by hand, or use the buttons above the input box of the full editor.
It is not a "read-ahead loop". It is a while-loop. Any attempt to process a record without reading it first would end in failure. That is all you have done, read the record to be processed before processing it. That process doesn't need a "name".
"read-ahead", as I think most people would use it, is when you read a record and it tells you (key change, some indicator, whatever) that you have to now process the record(s)/data that you have stored for that very purpose. Once all that is done, then you deal with the new record (probably storing it or data from it) and read again looking for a subsequent record which will tell you to again process the new set of data that has been stored from previously read records. Always remember that EOF is also going to tell you to finish processing what you have stored.
You might find it picky of me, but your second "determine the position.." is identical to the first. Taken literally (which is what we, and computers, tend to do with code) you have an infinite loop. Here you can only mean one thing, the "new position", but in other code examples the meaning may not be clear. If you are going to post code (after ensuring that it is something addressing the actual problem) then it should be "working" code, even if pseudo-code (ie not open to misinterpretation).