HP 3000 Manuals

BKUNLOCK [ KSAM/3000 Reference Manual ] MPE/iX 5.0 Documentation


KSAM/3000 Reference Manual

BKUNLOCK 

Unlocks a 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.  (Refer to Status Parameter discussion
                 earlier in this section.)  (Required parameter)

USING BKUNLOCK 

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 6-10 illustrates the use of BKUNLOCK to unlock the file after it
is updated.
__________________________________________________________________________
|                                                                        |
|     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 DETERHINE 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]|
|     1850 CALL BKERROR(S$,M$)                                           |
|     1860 PRINT M$                                                      |
|     1870 GOTO 3620                                                     |
|     1880 DOEND                                                         |
|     1890 REM                                                           |
|     1900 REM THE PROGRAM CONTINUES                                     |
__________________________________________________________________________

          Figure 6-10.  Dynamically Unlocking a KSAM File 



MPE/iX 5.0 Documentation