C$OSLockInfo not works with MF format files

We use C$OSLockInfo rutine to know which process is blocking one register file; the rutine returns the PID. It works OK with RM files format, but when we use it with MF files format, the rutine returns all 0.

Should we use the rutine in a diferent way when we use it with MF format files? Maybe we have to use another tool to get this information?

Thank you

  • Hello mikmng,

    Thanks for posting your question on the Micro Focus Community Site. To better help you, could you let us know which Micro Focus product and version you're using, and the Operating System and platform?

    On Unix platforms under Server Express and Visual COBOL Development Hub, there is a utility named 'wholock' that can be used to determine which process is holding a lock on a certain file. The most basic way to invoke it is:

        wholock filename

    Please let me know if this helps, and if not, the requested version and platform info.

  • Thank you Blair.

    I tested the utility and seems to work . However, we use C$SOLockInfo in Cobol Programs to know which process is blocking a particular register...

    It is possible to do this with wholock ?

    We use "Cobol Server" and "Development Hub"; the version is 2.2 Up1 HF6. The operation System is AIX 7.1

  • Hi mikmng,

    Since wholock is not a subprogram like C$OSLockInfo, I don't believe you'll be able to call it directly as a subroutine. However, you can use the Micro Focus function CALL "SYSTEM" to invoke wholock, with something like:

          move spaces to who-command
          move "testfile.dat" to file-to-check
          string
             "wholock "       delimited by size
             file-to-check    delimited by space
             " >wholock_results.txt"
             x"00"
            into who-command
          end-string
          call "SYSTEM" USING who-command

    Then, your program could read the contents of wholock_results.txt to determine the offending process(es). (Please bear in mind that this is a simple example, and is not meant to be used in a real application without some further coding.)

  • Thank you Blair, but with the contents of wholock_results.txt, how can I know which process is blocking a particular record if I know its key? It seems that the wholock output don't show which record is blocking each of the process

  • Thank you Blair, but with the contents of wholock_results.txt, how can I know which process is blocking a particular record if I know its key? It seems that the wholock output don't show which record is blocking each of the process

  • Thank you Blair, but with the contents of wholock_results.txt, how can I know which process is blocking a particular record if I know its key? It seems that the wholock output don't show which record is blocking each of the process

  • Hi mikmng,

    After checking into this, it appears that the wholock utility does not have the ability to identify the Process ID holding a given record. I'd like to refer this to our development group for further investigation. If you would, please open a Support Incident on the supportline.microfocus.com website for this question, and ask that it be referred to Blair McDonald.