Here is the problem I am having. I was running a table locking test when assigning invoice numbers. the test was being run from 3 different workstations at the same time and I kept getting "Error 111" when accessing the 'control' table. I could understand if I got the 'File in use by another user [108]. Below is the code used to run this test.
******************************************
SET TALK OFF
SET ECHO OFF
CREATE TABLE (TEMP3) (INVNO C(6), INVDATE D(10),;
AMOUNT N(10,2))
use TEMP3 shared
FOR X = 1 TO 10000
PRIVATE MINVNO
STORE "" TO MINVNO
SELECT 0
mINVNO=invnumb(X)
SELECT TEMP3
APPEND BLANK
REPLACE INVNO WITH MINVNO, INVDATE WITH CDATE, ;
AMOUNT WITH X
WAIT WINDOW("INV "+mINVNO) NOWAIT
ENDFOR
*************************************************
*************************************************
FUNCTION invnumb
LPARAMETER p1 && pass amount invoiced
LOCAL p2 && P1=amount P2= new invoice number
use "control" exclu
STORE STR(INVNO,6) TO p2
REPLACE INVNO WITH IIF(INVNO=999999,1,INVNO+1)
use
RETURN(p2)
endfunc
***********************************************************
Any Help is appreciated
Irwin
******************************************
SET TALK OFF
SET ECHO OFF
CREATE TABLE (TEMP3) (INVNO C(6), INVDATE D(10),;
AMOUNT N(10,2))
use TEMP3 shared
FOR X = 1 TO 10000
PRIVATE MINVNO
STORE "" TO MINVNO
SELECT 0
mINVNO=invnumb(X)
SELECT TEMP3
APPEND BLANK
REPLACE INVNO WITH MINVNO, INVDATE WITH CDATE, ;
AMOUNT WITH X
WAIT WINDOW("INV "+mINVNO) NOWAIT
ENDFOR
*************************************************
*************************************************
FUNCTION invnumb
LPARAMETER p1 && pass amount invoiced
LOCAL p2 && P1=amount P2= new invoice number
use "control" exclu
STORE STR(INVNO,6) TO p2
REPLACE INVNO WITH IIF(INVNO=999999,1,INVNO+1)
use
RETURN(p2)
endfunc
***********************************************************
Any Help is appreciated
Irwin