skip to main content

Library Routines : A$LIST_LOCKS

A$LIST_LOCKS
The A$LIST_LOCKS routine returns the list of active locks in an Application Server environment.
The list of locks is available only if iscobol.file.lock_manager * is set in the server configuration.
isCOBOL supports two types of lock:
The routine lists both of them.
It’s possible to filter the information and retrieve all the locks associated to a specific client (see threadID in LISTLOCK-OPEN) or all the locks associated to a specific file (see fileName in LISTLOCK-OPEN).
Syntax:
 CALL "A$LIST_LOCKS" USING opCode
Parameters:
Return-Code:
The definition and meaning of the returnCode depend on the opcode.
Examples:
Example - Open the list of locks for an Application Server, loop through all the locks to show them and close the list after that.
working-storage section.
copy "iscobol.def".
77  locklist                handle.
77  th-id                   pic 9(5).
77  usr-id                  pic x(3).
77  usr-name                pic x(32).
77  usr-addr                pic x(32).
77  usr-pcname              pic x(32).
77  usr-tid                 pic x(32).
77  usr-prog                pic x(32).
77  usr-count               pic 9(5).
77  lock-count              pic 9(5).
77  lock-filename           pic x(50).
77  lock-tid                pic 9(5).
77  lock-open-mode          pic 9(5).
77  lock-mode               pic 9(5).
77  lock-key-val            pic x(256).
77  lock-key-len            pic 9(3).
   initialize lock-filename lock-tid
   call "a$list-locks" using listlock-open
   if locklist < 1
      display message 
              "No Locks Found (verify iscobol.file.lock_manager)"
      exit paragraph
   end-if
   move 0 to lock-count
   perform until 1 = 2
      call "a$list-locks" using listlock-next
      if return-code = 0
         exit perform
      add 1 to lock-count
      | to get user information from lock-tid
      call "a$get-user" using lock-tid
   end-perform
   call "a$list-locks" using listlock-close
   display message "Number of locks : " lock-count.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left