How to figure out who has locked AS/400 program?

765 pts.
Tags:
AS/400
AS/400 Locking
AS/400 programming
I need to find out how to tell who has the program locked. can't have it updated if people are in a program

Software/Hardware used:
e

Answer Wiki

Thanks. We'll let you know when a new response is added.

If the program is interactive and uses a display file, you can check for the locks on the display file..

Otherwise, no easy way of doing it other than going through the call stacks of all jobs on the system (I wouldn’t recommend that)

Discuss This Question: 15  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    The first answer is "Nobody has it locked." It's almost certain that you'll never see a lock established on a program. Even if you do set a lock on a program, it won't slow anyone down who tries to run the program. The second answer is "It doesn't matter." If you have created the application correctly, then you can recompile while the program is in use. No one should notice. Where it can become a problem is when PGMA calls PGMB. If you recompile PGMA while the user's job is actually processing in PGMB, the return from PGMB back to PGMA can fail. However, it's not easy actually to make it happen... at least, not if you allow the system to manage the replacement of old program objects with new ones. If you are manually deleting program objects before you start the compilation of the replacement, you are on your own. In any case, the only way you can tell if any user is running a program is to retrieve the call stack of every user job in the system to see if your program is in the stack of any of them. The biggest problem will be that call stacks change so fast that the call stack of the first job may be different by the time you start looking through the second job. Obviously, by the time you get all the way through all jobs, you'll have to go back and start over again because many call stacks will already be obsolete. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Is the program called by a db2 trigger? Phil
    49,950 pointsBadges:
    report
  • TomLiotta
    ...a db2 trigger? That can get even more interesting when host server jobs are involved. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    Yes, but we're lacking response from the person who asked the question. Phil
    49,950 pointsBadges:
    report
  • TomLiotta
    That's why I added my comment, as a kind of 'ping' for the OP. Sooner or later, a question will be asked where a comment will get some attention. (I'm something of an idealist, I suppose.) Might as well talk amongst ourselves... Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    To keep a process from running twice I've seen it lock a data area .. it could just lock the program to prevent it from being run a second time while it's running. WRKOBJLCK or is it DSPOBJLCK should show the lock state of the program and the job(s) that have it locked. Why do I think he/she is really encountering a lock on a display file and not the program at all? Phil
    49,950 pointsBadges:
    report
  • philpl1jb
    The prizes should be for asking a question and then working with the "experts" to actully solve the problem and then acknowledging the solution.
    49,950 pointsBadges:
    report
  • TomLiotta
    I understood the question as being about concern over recompiling a program that is in use. When standard developer's functions are used, the manipulation of the old object into QRPLOBJ makes things fairly easy. Most of us are used to it, though the process itself is often unfamiliar. If it isn't known at all to a developer, it can be pretty confusing. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    it could just lock the program... That's what I've done for many years. It works fine for simple lock tests and it doesn't actually interfere with anything. It also doesn't require an extra object just for the purpose. Tom
    125,585 pointsBadges:
    report
  • Jaymz69
    The WRKOBJLCK Is what I needed to show me who is in the File. Thanks
    765 pointsBadges:
    report
  • EmNichs
    I completely agree, Philpl1jb...once the answer is resolved, the person who provided the answer and the person who asked the question will receive points for the "accepted answer" that may lead to a tangible prize. So realistically, that's exactly how the site works--as long as the question is completed.
    3,250 pointsBadges:
    report
  • TomLiotta
    ...Is what I needed to show me who is in the File. Glad you found an answer. Note that a lock on a "file" has an effect very different from a lock on the "program", and the question asked about a "program" that was locked -- the question left much to interpretation. Dialog could have gotten to the answer quickly. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    EmNichs I didn't answer this question, I think TomLiota and Adamwhiuk2002 seem to have gotten it while I, unfortunately, read the question in a way that mislead with some interesting but somewhat useless results. When people ask questions they rarely hang in there to help us sort out the question and alternative solutions. They are often one-time on the board, creating a profile on the fly, asking a question, and probably using a bogus e-mail. It's such a waste. Phil
    49,950 pointsBadges:
    report
  • Jaymz69
    [...] Jaymz69 needed to know how to figure out who has locked the AS/400 program. Adamwkiuk2002 and Philpl1jb provided answers, with Phil’s earning [...]
    0 pointsBadges:
    report
  • slateken
    Can't figure out why someone would ask how to tell who has a program locked when they really want to know who has a file locked. You all did a great job of cutting through the fog, but as Tom said, properly asked, the question would have been promptly and accurately answered. A minimal amount of care when posting the question would have saved this discussion from itself.
    230 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following