locked query in AS400

Posted on 2011-10-14
Last Modified: 2012-05-12

I've been asked to find out why we get an error message when trying to acces a query in AS400.
The error message is this one : "Query &1 in &2 in use, cannot be shared"

I don't have much experience with AS400 so I don't even know what is the first step to take to verify the locks on the query or on the job or anything like that.

Question by:vanroybel
    LVL 13

    Accepted Solution

    To check the locks, use the Work with Object Locks (WRKOBJLCK) command:

    Post back any questions
    LVL 34

    Assisted Solution

    by:Gary Patterson
    This just means that another use has the query open in WRKQRY and is in the process of modifying it.  Barry's instructions will help you find the job that is holding the lock so you can contact the user and ask them to exit the query.  IF you just end the job, their changes will be lost.

    - Gary Patterson
    LVL 26

    Expert Comment

    Gary is correct.

    The rest of the message says:

    Cause . . . . . :   The definition for this query is currently being created,
      changed, copied, or used in some way so that it cannot be shared at this

    Gary's wording is a real-life phrasing.

    It's odd, though, that you used the raw message text in your question. Do your users actually see the "&1" and "&2" in the message when it appears? Or did you locate the QQRYMSG message file and look at the message definition?

    If your users are seeing the 'raw' message, then there's something else somewhere that should be considered.


    Author Closing Comment

    Thanks for the help. The query worked a bit later it was because of a network problem.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
    Outlook Free & Paid Tools
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 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

    22 Experts available now in Live!

    Get 1:1 Help Now