Object Locks

Posted on 2009-04-27
Last Modified: 2013-12-06
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....
Question by:Bsidmis
    LVL 4

    Assisted Solution

    Hi BSID team,

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


    Author Comment


    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
    LVL 34

    Accepted Solution

    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

    Author Comment

    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
    LVL 34

    Assisted Solution

    by:Gary Patterson
    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

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Hello I read in a discussion about a person who configured a very simple mirror RAID with two hard drives; the system and data were on the same partition. He asked how to repair the system as it was not booting up anymore. In his case running …
    Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now