Hello
The problem is: i have one file, which i write once and then i do updates to it several times.
In detail:
- I have one procedure to write the file, that is called only once.
- I have one procedure to update the file written. This procedure is called only in one place in the whole code, but this call is placed into a dowhile, because i need to update the file several times.
So, i call the procedure to write the file. Then i call the procedure to update it (by first time), and updates successfully. When i call the update procedure again, the "dow not %eof" that is placed inside the procedure, to update all records on file, seems like it never reachs the "%eof" condition, because it keeps in a loop! Once it reads the last record it begins again with the first and so on.
I have tried closing and opening the file before the update, nothing changed.
I can't update by SQL because not all fields of all records must have the same data.
My concern is why the file is updated on the procedure first call and in the second the procedure stays in a loop?
I have not the real code here, but something like this:
main procedure:
Update procedure:
When i call the update procedure for the second time, it keeps looping in the "dow", but not when the first time! 
Any suggestion please?
The problem is: i have one file, which i write once and then i do updates to it several times.
In detail:
- I have one procedure to write the file, that is called only once.
- I have one procedure to update the file written. This procedure is called only in one place in the whole code, but this call is placed into a dowhile, because i need to update the file several times.
So, i call the procedure to write the file. Then i call the procedure to update it (by first time), and updates successfully. When i call the update procedure again, the "dow not %eof" that is placed inside the procedure, to update all records on file, seems like it never reachs the "%eof" condition, because it keeps in a loop! Once it reads the last record it begins again with the first and so on.
I have tried closing and opening the file before the update, nothing changed.
I can't update by SQL because not all fields of all records must have the same data.
My concern is why the file is updated on the procedure first call and in the second the procedure stays in a loop?
I have not the real code here, but something like this:
main procedure:
PHP Code:
WriteFile();
dow some_condition;
DoSomeCalculations();
UpdateFile();
CopyUpdatedRecordsToAnotherFile();
enddo;
PHP Code:
setll *loval file;
read file;
dow not %eof;
field1 = number1 * tax1;
field2 = number2 * tax2;
update file;
read file;
enddo;

Any suggestion please?





Comment