Highlighted
Absent Member.
Absent Member.
731 views

[archive] C$LOCKPID in Windows?

[Migrated content. Thread originally posted on 18 March 2004]

If I encounter an error 99 in a Windows environment, I really need to know WHO has a lock on a particular record. It seems like I would be able to do this in a Unix/Linux environment with the C$LOCKPID routine. Is there anyway to do this in Windows? We moved our programs over from a Wang Laboratories system and we were able to do this very easily. Has anyone turned on logging/rollback in order to find out this information?
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] C$LOCKPID in Windows?

For some reason, there is no mechanism in Windows that provides you with the exact record lock, however, it is a feature in the Windows API that will show you who has a file open. This is the best bet you can get then. A disadvantage with this only method is also that you need account manager or administrator privileges to access this part of the Windows API.
There is a sample program available (ACUCOBOL-GT source) that illustrates how to use this API to
a) enumerate open files:
- On a specific machine
- In a specific directory (including subs)
- For a specific user

b) Send a message to that user

c) Force a closure of the file (bad, bad)

Ask your tech support contact for demo source on this, or yell here if not.

Note that this API is only available in the Widechar mode, which makes it a bit tricky to understand. If you want to go deeper into this stuff, you should consider attending our Advanced Windows programming training.
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.