[net.micro.pc] A bug in dBase III

forrest@ucsbcsl.UUCP ( ) (02/04/85)

The following is a minor but annoying bug I found in dBase III. The
line numbers are for reference, they are not part of the files in
question.

1	DO WHILE .T.
2		INPUT 'Enter task ' TO TASK
3		OK = .T.
4		DO WHILE OK
5			OK = .F.
6			DO CASE
7				CASE TASK = 3
8				DO C:TEST
9			ENDCASE
10		ENDDO
11	ENDDO

1	* THIS IS THE TEST PROGRAM CALLED IN LINE 8 ABOVE
2	? 'IN TEST'
3	DO WHILE .T.
4		? 'IN WHILE'
5		RETURN
6	ENDDO

What happens is that after TEST returns pack to the calling program,
the calling program resumes at line 5 and not line 4. In other words,
even though OK has been set to .F., which would stop the WHILE loop at
line 4, line 4 is not executed. What you get is an infinate loop.
I believe the problem is caused by the RETURN in line 5. If I take it out
the program works as expected. There is no mention in any dBase
documentation that you shouldn't exit WHILE loops with a RETURN
statement.

I should mention that the programs shown are fragements of larger
programs and should not be taken as being inherently meaningful.

Also, I volunteer to serve as a central bug report library for
dBase III, if there is a need. If you send me anything, please
include your company namem and real phone number. I have problems
figuring out how to reply to people's mail on this crazy net.

genej@ecsvax.UUCP (Gene Jackson) (02/13/85)

I noticed a similar Dbase III problem with the do while going to 
the wrong line. I found that it was going to the line above the
line which it should have gone to.  This may be the case here as
OK is set to true in the line above which would also cause the
program to loop indefinetly.  In any case there is a definet problem
sometimes with the DO WHILE construct in dBase III.