Lock Instruction
Syntax
Lock [#]StreamNum
-or-
-or-
Lock [#]StreamNum, [start] To end
Group
Description
Form 1: Lock all of StreamNum.
Form 2: Lock a record (or byte) of StreamNum.
Form 3: Lock a range of records (or bytes) of StreamNum. If start is omitted then lock starting at the first record (or byte).
Notes:
- Be sure to Unlock for each Lock instruction.
- For sequential files (Input, Output and Append) lock always affects the entire file.
Parameters |
Description |
Streams 1 through 255 are private to each macro. Streams 256 through 511 are shared by all macros. |
|
For Random mode files this is the record number. The first record is 1. Otherwise, it is the byte position. The first byte is 1. |
|
First record (or byte) in the range. |
|
Last record (or byte) in the range. |
See Also
Example
Sub Main
Dim V As Variant
Open MacroDir & "\SAVE_V.DAT" For Binary As #1
Lock #1
Get #1, 1, V
V = "Hello"
Put #1, 1, V
Unlock #1
Close #1
End Sub