Microsoft KB Archive/59761

= &quot;Permission Denied&quot; with > 20 LOCKs with SHARE Loaded =

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, &quot;Permission Denied&quot; 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 &quot;Permission Denied&quot; on the first LOCK statement. With QuickBasic and the Basic compilers (listed above), 3120 LOCKs can be performed without SHARE loaded before the &quot;Permission Denied&quot; 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 &quot;xxxx.xxx&quot; FOR RANDOM AS #1 40 FOR i%=1 TO 32767 50   LOCK #1,i% 60 NEXT 70 PRINT &quot;More than 32767 LOCKs available!&quot; 80 END 100 PRINT &quot;Permission Denied (&quot;;ERR;&quot;)&quot; 110 PRINT &quot;Number of locks = &quot;;i%-1 120 END

Additional query words: QuickBas BasicCom

Keywords: KB59761

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.