Using KSAM/XL and KSAM 64 (32650-90886)

Appendix B 259
BASIC/V Intrinsics
BKUNLOCK
BKUNLOCK
Unlocks a KSAM file dynamically locked by BKLOCK.
CALL BKUNLOCK(
filenum,status
)
A file locked by BKLOCK is released for use by other users with a call to BKUNLOCK. (If you
log off from any connection with the system, the file is also unlocked.) Since dynamic
locking takes place during shared access to the same file by more than one user, it is
important that any file locked by BKLOCK be unlocked as soon as possible by BKUNLOCK.
To use BKUNLOCK, the file must be opened with dynamic locking allowed by all users who
share access to the file.
Parameters
filenum
A numeric variable containing the file number that identifies the file. This
number was returned to
filenum
by the last call to BKOPEN. It should not
be altered until the file is successfully closed by BKCLOSE. (
Required
parameter
)
status
A four-character string variable to which is returned a code that indicates
whether or not the call to BKLOCK was successful and if not, why not. The
first character is set to zero when the call succeeds, to another value if it
fails. (
Required parameter
)
Operation Notes
After calling BKUNLOCK, you should always check the status parameter to make sure that
the procedure was successfully executed. When successful, a file locked by BKLOCK is again
made available for access by other users. If the file is not locked by BKLOCK when BKUNLOCK
is called, the file is not affected.
Figure B-12. illustrates the use of BKUNLOCK to unlock the file after it is updated.
Figure B-12. Dynamically Unlocking a KSAM File
1700 REM *****************************************************
1710 REM * UNLOCK A KSAM FILE *
1720 REM *****************************************************
1730 REM
1740 REM F IS THE FILE NUMBER OF A KSAM FILE
1750 REM OPENED BY A CALL TO BKOPEN
1760 REM
1770 CALL BKUNLOCK(F,S$)
1780 REM
1790 REM NOW DETERMINE WHETHER THE CALL HAS SUCCEEDED
1800 REM
1810 IF S$(1;1)<>"0" THEN DO
1820 REM N$ CONTAINS THE NAME OF THE KSAM FILE
1830 REM S$ CONTAINS THE STATUS CODE SET BY THE PRECEDING CALL
1840 PRINT "UNABLE TO UNLOCK ";N$;" ERROR ";S$(1;1);"DETAIL ";S$[2]