Subject Re: PRG keeps looping back to start
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 11 Jul 2020 10:21:05 +0200
Newsgroups dbase.getting-started

On 2020-07-11 03:22, Gaetano De Luisi wrote:
> I have a do while loop to cycle through records to look for missing records for a time interval while .not.eof()
>  From what I can tell, the initial DO WHILE loop EOF() condition evaluates to TRUE because the msgbox("End of do while was reached","Warning",64) does get triggered
> Nevertheless, after that msgbox is closed, the whole PRG file executes again instead of exiting. If there was a failure in the logic and EOF was never reached, I could understand that the routine would go in loops forever, but I cannot understand what triggers the loop-back to the start of the routine even though the DO WHILE does end and I do see the "GAP Found" timestamp value progressing to the last record.
> FYI, the reason I delete some records at the start is to create the gaps, because when there are no gaps, the code executes as expected, the logfile contains the timestamp of when it was run and "No gaps found!", and the program doesn't go back to the start of the routine once the last record is reached.
> What am I doing wrong?
> //integrity checks
> //log gaps in interval data
> use energydata.dbf order etimestamp excl
> goto top
> delete all for Mins=55
> pack
> goto top
> nCurrDay = dd
> nCurrMins=Mins
> skip 1
> nNextDay = dd
> nNextMins=Mins

It is much easier to troubleshoot if one has some sample data to work
with.  One can then add some "traps" in likely places in the program so
that one can see what is actually happening.  Without test data one has
to resort to mental gymnastics and I'm really getting too old for that.