Do While's are troublesome, but I do use them from time to time. I
usually add a Sleep() to inject a system-induced pause to keep the loop
from running at full-tilt top speed. Psuedocode example follows...
DECLARE Sleep IN Win32API INTEGER nMilliseconds
local lnMaxIterations, lnCounter
lnCounter = 0
lnMaxIterations = 10 && will exit the do while loop after approx. 10
seconds of checking
Do While .t.
=sleep(1000) && sleep for 1 second
* check on something, based on the check proceed accordingly
if something=.t.
exit
endif
lnCounter=lnCounter + 1
* if we have reached our max try count, bail
if lnCounter >= lnMaxIterations
exit
endif
endd
You might also want to add a "Flush" (with or without a "Force") after
closing the file to tell Windoze you want it to process anything it
might be caching.
Mike
-------- Original Message --------
Subject: Re: Unexplained Error 1705 "Access Denied" Errors
From: Ken Dibble <[email protected]>
To: [email protected]
Date: 7/19/2013 1:06 PM
Ah. Two (or more) computers are involved. That makes it dicey to
delete files except in this case it should work since you have an
obvious "master" "slave" thing going. I'm guessing that the Master
computer creates the table and the Slave is checking if the tables
existe, and when found the report is printed and the Slave erases the
tables?
Is there a third system, a server, storing the tables? I still think
some file handle is not being released quickly enough by whatever
system is actually storing the table(s) that you are trying to share
and then delete.
Or I may not grok the configuration correctly.... :)
No, it's all on the same computer. The files are created in the
working directory, and then the separate printing .exe, which resides
in the same directory, is called. When that process finishes, it
creates a .txt semaphore file in the same directory, containing a
result code. My calling application is able to pick that up and read
it successfully. I think you may be right about the Windows file
handle though, since that appears to operate independently of VFP and
anything else touching the files, really.
I went with this approach because with earlier systems, users were
somehow able to badly corrupt the data while attempting to make data
entry changes at the same time that reports involving that data were
printing. I used the same approach for report data that I do now: a
separate denormalized report-specific cursor. I've NEVER, EVER simply
done a report on a live data table. So I don't even understand how
those users were able to corrupt the live data by editing it while a
separate report cursor containing it was being printed, but corrupt it
they did, so... I went with the separate printing .exe.
If I go with the DO WHILE TRY...CATCH loop for ERASE, any thoughts on
how I can minimize getting into an infinite loop? Sure, I can limit
the number of iterations, but I have no idea what that limit needs to
be to be effective. Unfortunately, I can't reproduce this problem on
demand.
Thanks.
Ken Dibble
www.stic-cil.org
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.