|
rick baird <rick.baird@xxxxxxxxx> wrote: >> 01 FOR COUNT=1 TO %Elem(keyARRAY); >> 02 key4file=keyARRAY(COUNT); >> 03 chain key4file KEYEDFILE; >> 04 if %Found(); >> 05 dow NOT %Eof(); >> 06 register(); >> 07 reade key4file KEYEDFILE; >> 08 ENDDO; >> 09 endIf; >> 10 endFor; > >once the first loop is done, the condition %eof value is "true". >it remains true until the next setll (is that what register does?) I don't think so. By using chain to prime the loop and reade at the end it should not be necessary to use setll at all. >after the first iterration of the loop, the DOW NOT %EOF() fails to >enter the do, because it IS %eof. > >This is due to the fact that you have not specified a file name on >your %eof() bif. >%eof() - with no file name - is not effected by chain, setll, etc. > >Change it to %eof(KEYEDFILE) and it should work. > >it's good practice to include the file name in all file condition bifs >for this reason, and for clarity and maintainability. This is all true. However, the simplest change to Igor's original code would probably be to replace the "dow NOT %Eof()" to "dou %Eof()". Normally when you prime a loop and read at the end you would use dow, but the "if %found()" prevents the loop from being entered if it is not primed with a successful chain. And as the reade is the last thing that happens before the end of loop test there is no danger in not qualifying the %eof, although qualifying it does make for more readable code. -- Dave... _________ ,___o __________ _\ <;_ http://www.audax.uk.net ___________ (_)/ (_) http://www.twickenhamcc.co.uk ======================================================= The opinions expressed in this communication are my own and do not necessarily reflect those of my employer. ______________________________________________________________________ This message may contain confidential information which may also be legally privileged and is intended only for the use of the parties to whom it is addressed. If you are not an intended recipient you are hereby notified that any disclosure, copying, distribution or use of any information in this e-mail is strictly prohibited. If you receive this message in error please notify the sender by return e-mail and then destroy it. Further, we make every endeavour to keep our network free from viruses. However, you do need to verify that this e-mail and any attachments are free of viruses as we can take no responsibility for any computer viruses which might be transferred by way of this e-mail. All information and attachments remain the property of Stolt Offshore Group and should be held as confidential.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.