Yet again I've encountered weird behavior with dBase 5 for DOS in the Windows 2000 and XP environment and so here's my documentation of this issue. Two different programmers have stumbled across this issue a total of 3 times this year.
Each program is a little different but here is the overall environment: dBase 5.0 for DOS, the program files and the data files are all running on a Windows 2000 Server. There are no problems seen with older Windows 98/Me workstations. But if you use the SCAN loop from a Windows 2000 or XP workstation sometimes you're exited (dropped, bumped, ejected, blown out, etc.) from the loop prematurely long before reaching the actual end of the records.
Here are a couple simplified examples.
In the following example, the scanned table is opened NOUPDATE but I think it becomes unstable anyway apparently after hitting 2 or 3 records locked by others and the scan exits prematurely.
USE myTable NOUPDATE
SCAN
xFile = mytable->otherTable
USE (xFile) ORDER myOrder IN SELECT() NOUPDATE
SELECT (xFile)
IF SEEK(my_data,xFile)
? "Record found"
ENDIF
USE
SELECT myTable
ENDSCAN
USE IN myTable
In the following example, after hitting 2 or 3 records locked by others, the scan exits prematurely. Adding UNLOCK alone does not resolve the flaky abort, but adding the RLOCK() test does work.
SET EXCLUSIVE OFF
USE myTable
SCAN
REPLACE myField WITH myData
ENDSCAN
USE IN myTable
This happens whether or not we place a filter on the table or use the SCAN FOR or not. Something is causing the SCAN to get out of synch somewhow. Perhaps the answer is to always test first with RLOCK() in a multi-user environment but I wouldn't have thought it of any consequence with a table opened NOUPDATE.
If a program command is unreliable in a somewhat unpredictable pattern, I get worried.
Replacing the SCAN/ENDSCAN loop with DO WHILE/SKIP/ENDDO avoids this issue but it is an unfortunate workaround since SCAN was meant to be the best way to automatically go through a table record by record.
Legacy software - beware!
dbMark
Each program is a little different but here is the overall environment: dBase 5.0 for DOS, the program files and the data files are all running on a Windows 2000 Server. There are no problems seen with older Windows 98/Me workstations. But if you use the SCAN loop from a Windows 2000 or XP workstation sometimes you're exited (dropped, bumped, ejected, blown out, etc.) from the loop prematurely long before reaching the actual end of the records.
Here are a couple simplified examples.
In the following example, the scanned table is opened NOUPDATE but I think it becomes unstable anyway apparently after hitting 2 or 3 records locked by others and the scan exits prematurely.
USE myTable NOUPDATE
SCAN
xFile = mytable->otherTable
USE (xFile) ORDER myOrder IN SELECT() NOUPDATE
SELECT (xFile)
IF SEEK(my_data,xFile)
? "Record found"
ENDIF
USE
SELECT myTable
ENDSCAN
USE IN myTable
In the following example, after hitting 2 or 3 records locked by others, the scan exits prematurely. Adding UNLOCK alone does not resolve the flaky abort, but adding the RLOCK() test does work.
SET EXCLUSIVE OFF
USE myTable
SCAN
REPLACE myField WITH myData
ENDSCAN
USE IN myTable
This happens whether or not we place a filter on the table or use the SCAN FOR or not. Something is causing the SCAN to get out of synch somewhow. Perhaps the answer is to always test first with RLOCK() in a multi-user environment but I wouldn't have thought it of any consequence with a table opened NOUPDATE.
If a program command is unreliable in a somewhat unpredictable pattern, I get worried.
Replacing the SCAN/ENDSCAN loop with DO WHILE/SKIP/ENDDO avoids this issue but it is an unfortunate workaround since SCAN was meant to be the best way to automatically go through a table record by record.
Legacy software - beware!
dbMark