Thanks for your reponses. I'll reply to each of you:
Griff: each program runs on its own local harddrive. Folders can be shared but the errors do not involve sharing within Clipper programs. By “opportunistic file locking” are you referring to Clipper’s Flock() or something in Windows?
David: Where are the permissions? I looked in Windows and couldn’t find what you were referring to.
Jock: 1) I’m using Clipper 5.2 with the 5.2d patch. 2) The problem occurs with multiple different NTX files, and typically in routines that are used frequently (like repainting the screen with data). I assume that is because those files are opened more frequently so more likely to run into trouble--though at first it did make me wonder if it was problem with those particular parts of the program (this dates back to the earlier dbf opening failures which were fixed with the net_use function you posted). 3) Seems like recreating the index each time might slow things down, but I suppose not in current environments. However I still have to Set Index to Indxname so I’d run into the same trouble there. 4) Disabling write caching might be something to consider as another reason for the sharing violation but.....
But here’s my conclusion: it is my Computer Associates antivirus program. (How’s that for irony?) By disabling real time protection on the machine that was crashing three times a day there have been no crashes the last two days. Pretty good circumstantial evidence I think.
In the last few days I’ve written this routine to use instead of “Set Index To…” Watching with my error trapping routine I think I saw an instance when it worked successfully allowing the index file to open on the second try. Obviously I don’t want to run the computers without real time virus surveillance so I’m still working on replacing all my "Set Index To’s" with Set_ntx({“indxnam1”,”indxnam2”})
PROCEDURE SET_NTX()
/*opens ntx files checking success.
parameters: array of ntx files to open (names in quotes)
numeric wait time in seconds or empty for default of 30 seconds */
PARAMETERS FILES, WAIT
//set variables
PRIVATE ASAVE, N, WSAVE
PRIVATE NUMB := LEN(FILES)
PRIVATE NNTX := 0 //number of index files successfully opened.
IF EMPTY(WAIT)
WAIT = 30 //default is 30
ENDIF
WSAVE = WAIT
//loop to open ntx's
FOR N = 1 TO NUMB
//open each ntx
WAIT = WSAVE //reset wait
DO WHILE WAIT > 0
DBSETINDEX(FILES[N])
//test for open
IF LEN(INDEXKEY(NNTX+1)) > 0
/* if argument equals zero intially it checks controlling index
so the test fouls if second index not opened since controlling index still there */ /*in looking at this again I guess I could just initialize with NNTX :=1 and use argument of NNTX and it would work as well*/
NNTX++
EXIT
ENDIF
//watch the time
INKEY(1) //wait 1 second
WAIT = WAIT - 1
@ 0,72 SAY 'NTX ' + ALLTRIM(STR(WAIT))
ENDDO
//handle unsuccesful opening
IF WAIT = 0
ASAVE = SAVESCREEN(10,15,20,63)
@ 10,15 CLEAR TO 20,63
@ 10,15 TO 20,63
@ 12,17 SAY FILES[N] + ' NOT OPENING'
@ 14,17 SAY 'Alt-C NOW TO ABORT'
@ 16,17 SAY 'OR "Y" TO CONTINUE PROGRAM WITH UNOPENED INDEX'
@ 18,17 SAY ' CAUSING MALFUNCTION OR CRASH'
DO WHILE .NOT. UPPER(CHR(INKEY())) $ 'Y'
ENDDO
RESTSCREEN(10,15,20,63,ASAVE)
ENDIF
NEXT
RETURN
I'm glad for any other feedback/answers. Thanks.