Highlighted
Absent Member.
Absent Member.
1808 views

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

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: C$OSLockInfo not works with MF format files

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.

Blair McDonald

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: C$OSLockInfo not works with MF format files

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

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: C$OSLockInfo not works with MF format files

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.)

Blair McDonald

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: C$OSLockInfo not works with MF format files

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

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: C$OSLockInfo not works with MF format files

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.

Blair McDonald

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.