Object Locks

Dear Team,

We are trying to read datas from one file which is logical file?
If I am giving authority to that logical file, is the Authority to the logical file is sufficient to read the
file? In that case I am not giving authority to the Physical file?

Specific Physical file having 125 logical files, If i want to give authority to any one of the file means both the Physical and Logical files should not be in lock?
If it is so means, how to find the other locked objects of the specific file?
Is their any way to find the locked objects of that file?

BSID team....
Who is Participating?
Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
There are several ways to find which logical files are causing a lock on a particular physical file:

1) DSPDBR for the physical, and then WRKOBJLCK for each of the listed logicals.  You could also write a little CL to do this.
2) WRKOBJLCK MEMBER(*ALL) on the physical, and use option 8 to see job locks for each job.  The job-level locks will show which logical is causing the physical lock.

Technically,  a user must have data authority to both the physical file and the logical file in order to access the data.  It is possible to use logical files as a mechanism to limit access to the underlying physical, though:

1) Grant the appropriate data authorities to the physical file and the logical file to the user(s) or group(s) in question.
2) Revoke *OBJOPR authority to the physical file to prevent the user from accessing the physical file directly.

- Gary Patterson
LewisPowerConnect With a Mentor Commented:
Hi BSID team,

By using WRKOBJLCK OBJ(LIBXXX/ABCD) OBJTYPE(*FILE) MBR(*ALL) command, you should have all the possible locks on the file.

BsidmisAuthor Commented:

Hi Lewis,
By this command I am able to see who locked that file, but I dint get the file names which is locked?
And one more thing, Logical file authority is sufficient to read the file or we want to give
authority to both physical and logical file?
Do the need full for this question?

BSID team
BsidmisAuthor Commented:
Through commands it is very difficult to check the object locks,.
Because Our Physical file contains 125 logicals and they are user by more than 20 users, so to check the lock we want to write one program..
After Wrkobjlck command in CLLE, how it possible to give the '8' option programatically,
Since they are IBM defined files, and we dont know the Display files, etc..
Is their any other way , to find the lock of Particular objects in programming?
i.e . Incase of 1 PF having more than 100 logicals..
Give us any solution to this problem?
BSID team
Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
If you want a fully-automated solution, then I suggest the following approach:

1) Use DSPDBR OUTPUT(*OUTFILE) to generate a list of all of the related logicals for a given physical.
2) Create a user space using the QUSCRTUS API to hold lock info from the QWCLOBJL api, below.
2) Code a loop that reads the output file and calls the QWCLOBJL API for each logical listed in the outfile.
3) Retrieve the user space, display or print the contents, and delete the user space.  I've provided links the relevant API documentation below.


- Gary Patterson
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.