Microsoft KB Archive/59761

From BetaArchive Wiki
Knowledge Base


Article ID: 59761

Article Last Modified on 11/21/2006



APPLIES TO

  • Microsoft GW-BASIC 3.2
  • Microsoft GW-BASIC 3.22
  • Microsoft GW-BASIC 3.23
  • Microsoft QuickBasic 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBasic 4.5 for MS-DOS
  • Microsoft BASIC Professional Development System 7.0



This article was previously published under Q59761

SUMMARY

With the DOS SHARE utility loaded, the error message, "Permission Denied" occurs when a program attempts to LOCK more than the available number of LOCKs. The number of LOCKs is specified with the /L:n option for the SHARE command. The default number of LOCKs is 20.

This information applies to Microsoft GW-Basic Versions 3.23, 3.22, and 3.20, to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b, and to Microsoft Basic Professional Development System (PDS) Version 7.00 for MS-DOS.

MORE INFORMATION

Without SHARE loaded, GW-Basic gives "Permission Denied" on the first LOCK statement. With QuickBasic and the Basic compilers (listed above), 3120 LOCKs can be performed without SHARE loaded before the "Permission Denied" error occurs.

For more information about the SHARE statement, please see the MS-DOS reference manual.

Code Example

The following code example tests the number of LOCKs available on a system:

   10  ON ERROR GOTO 100
   20  REM Note: File does not need to exist before run to LOCK records.
   30  OPEN "xxxx.xxx" FOR RANDOM AS #1
   40  FOR i%=1 TO 32767
   50    LOCK #1,i%
   60  NEXT
   70  PRINT "More than 32767 LOCKs available!"
   80  END
   100 PRINT "Permission Denied (";ERR;")"
   110 PRINT "Number of locks = ";i%-1
   120 END
                


Additional query words: QuickBas BasicCom

Keywords: KB59761