BBS: Inland Empire Archive Date: 09-17-92 (14:50) Number: 316 From: GARY POOL Refer#: NONE To: CHRISTOPHER MOLNAR Recvd: NO Subj: ISAM Databases and sharin Conf: (2) Quik_Bas
CM>Is it possible to share an ISAM Database on a multi-user system??? Has CM>anyone out there ever done it??? Can anyone out there tell me how to do CM>it? I tried opening with share.. no luck, I tried ignoring share, I get CM>permission denied! Any ideas??? Try this. I believe it should work. '***** Program FILELOCK.BAS ' N.B. Before using any BASIC program that implements record locking ' you have to install the DOS SHARE command. The SHARE command ' creates a local lock table that keeps track of which records ' that are in use. Type InvoiceHdr InvoiceNbr AS LONG AcctNbr AS STRING * 6 Terms AS STRING * 20 InvoiceTotal AS CURRENCY End Type DECLARE SUB ChangeRecord (e AS InvoiceHdr) DECLARE SUB GetData (e AS InvoiceHdr) DECLARE SUB AddRecord (e AS InvoiceHdr) DIM InvoiceHdrRec AS InvoiceHdr DIM LastRecord, RecNo AS Long ON ERROR GOTO ErrorHandler OPEN "INVHDR.DAT" FOR RANDOM SHARED AS #1 LEN = LEN(InvoiceHdrRec) DO CLS: PRINT "(A)dd a record, (C)hange a record, or (Q)uit "; Choice$ = INPUT$(1): Choice$ = UCASE$(Choice$) PRINT Choice$ LastRecord = LOF(1) / LEN(InvoiceHdrRec) SELECT CASE Choice$ CASE "A" CALL Addrecord(InvoiceHdrRec) PUT 1, LastRecord + 1, InvoiceHdrRec CASE "C" PRINT "Enter the number of the record to update (1 to"; PRINT LastRecord; ")" DO Input "Record Number "; RecNo LOOP UNTIL RecNo > 0 AND RecNo <= LastRecord TryLock: Lock 1, RecNo Get 1, RecNo, InvoiceHdrRec CALL ChangeRecord(InvoiceHdrRec) PUT 1, RecNo, InvoiceHdrRec UNLOCK 1, RecNo CASE "Q" END SELECT EndLoop: LOOP UNTIL Choice$ = "Q" CLOSE #1 ErrorHandler: SELECT CASE ERR CASE 70 LOCATE 22,10: PRINT "Record"; RecNo; "is currently in use" LOCATE 23,10: PRINT "Would you like to try again (Y/N)" Try$ = Input$(1) Try$ = UCASE$(Try$) LOCATE 22, 10: PRINT SPACE$(60) LOCATE 23, 10: PRINT SPACE$(60) IF Try$ = "Y" THEN CLS: RESUME TryLock ELSE RESUME EndLoop END SELECT SUB AddRecord (NewRecord AS InvoiceHdr) CALL GetData (NewRecord) END SUB SUB ChangeRecord (ChgRecord AS InvoiceHdr) PRINT "Old Record" PRINT USING "Invoice Number: ########## "; ChgRecord.InvoiceNbr PRINT USING "Account Number: \ \"; ChgRecord.AcctNbr PRINT USING "Terms: \ \"; ChgRecord.Terms PRINT USING "Invoice Total $$,#####.## "; ChgRecord.InvoiceTotal PRINT: PRINT "Enter New Data:" CALL GetData(ChgRecord) END SUB SUB GetData ( e AS InvoiceHdr) INPUT "Invoice Number "; e.InvoiceNumber INPUT "Account Number "; e.AcctNbr INPUT "Terms "; e.Terms INPUT "Invoice Total "; e.InvoiceTotal END SUB þ OLX 2.1 TD þ Market Share means never having to say you're sorry! --- WM v2.00/91-0231 * Origin: The Modem Zone BBS (314) 893-5106 (1:289/2)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET