HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

4-: 75
140 LINPUT #1,1; C$[1;8]
LOCK
The LOCK statement requests exclusive access to a file, for the program
that executes the lock statement. If the file cannot be accessed at the
time the LOCK statement is executed, an option can be specified to delay
execution of the LOCK statement until the program has exclusive access.
Syntax
LOCK
#fnum
[; WAIT
num_var
]
Parameters
fnum
The file number that HP Business BASIC/XL uses to
identify the file. It is a numeric expression that
evaluates to a positive short integer.
num_var
A numeric variable that contains a file locking flag.
Two conditions occur dependent on the value assigned to
num_var
prior to the LOCK statement:
* Zero: File unlocking occurs unconditionally. If
the file is being accessed by another program,
execution of the LOCK statement is suspended until
the file can be locked.
* Non- Zero: File locking occurs only if the file is
not currently locked. If the file is locked,
program execution resumes without locking the file.
If the file is successfully locked, the value one is
assigned to
num_var
. If the value of num_var prior to
the call is nonzero, then an unsuccessful attempt to
lock the file results in zero being assigned to
num_var
.
Examples
100 CREATE "File1",FILESIZE=1200 !Creates File1
200 ASSIGN "File1" TO #10 !Assigns File1
300 LOCK #10 !Locks File1
400 PRINT #10; A,B,C
500 UNLOCK #10 !Unlocks File1 after printing
999 END
LOOP
The LOOP, EXIT IF, and ENDLOOP statements define a loop that repeats
until the numeric expression in the EXIT IF statement is TRUE (nonzero).
Syntax
[EXIT IF
num_expr
]
[[
stmt
] ] {ENDLOOP }
LOOP [
stmt
]...[. ]...{END LOOP}
[. ]
[. ]
Parameters
stmt
A program line that can be another LOOP statement.
These statements constitute the loop body.
num_expr
A numeric expression that determines program control.
Considered FALSE if the value following evaluation is
zero, TRUE if it evaluates to nonzero. If FALSE,
control is transferred to the line following the EXIT IF