Need to Identify whether a program is using by any user

195 pts.
Tags:
CL Program
RPG Program
I need to create a program which need to verify whether a specific program is using by any other user in the environment, before allowing the user to use the program. Is there any way we can identify in CL or RPG that a program is using by how many users at a specified time?

Answer Wiki

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

Hi Tom,

Thanks for the response.  My requirement is as follows.

We don’t have any locks on the program. 

1.  User 1 access program1.  Program 1 can be accessed by many users at the same time due to business requirement.  Hence, we can’t lock for user 1. 

2.  As we don’t want 2 users from same department to use this program same time due to business application limitation, we need to know whether any other user from same department is using this program when user 1 access.

Hope you have clear picture now.  Any suggestions.

Discuss This Question: 8  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
    What does "using by any other user" mean? Can you explain? Do you want to know if some user is running a particular program? Or will you want to know about different programs at different times? -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    you can list out user using the specific pgm object by using WRKOBJLCK command   No, you can't. Not unless you also create some way of placing a lock on the *PGM that WRKOBJLCK will report. Running a program doesn't place a lock by itself on the program.   That's why more information is needed for the question. It's relatively easy to create a locking function for particular programs. It's much more involved to do it for generic "programs".   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    How is the program accessed? Usually there will be a menu or some accessible item that users get to in order to run a program. Do you have the source for the program or source for the menu (or what the access object is)? -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    BTW, yes, it's possible to determine if a program is in use. But first, how exactly were you thinking that knowledge would be used? And second, it's a pretty complex and potentially time consuming operation. It couldn't be considered to be guaranteed accurate at all times. There are better ways to go. -- Tom
    125,585 pointsBadges:
    report
  • Cursorposition
    Hi Tom,  Thanks for the information.  The program is accessed througha Menu Option.  Can you share with me the most feasible option to achieve this?
    195 pointsBadges:
    report
  • Cursorposition
    We have the source for Program.
    195 pointsBadges:
    report
  • TomLiotta
    ...we don’t want 2 users from same department to use this program same time ...   That part needs to be clarified first. How will you determine if two users are in the same department?   It's easy to lock a program so that only one user can run it at a time. But trying to create a method that only locks some users some of the time takes a little structuring. Identifying users and departments is necessary before deciding on an appropriate method.   For example, I might use a user index. When a user tries to run the program, I would retrieve the user's department and insert the department name into the user index. When the program ended, I'd remove the index entry for that department name.   If a second user from the same department tried to run the program, the attempt to insert the index entry would fail because the department name had already been added. A user from a different department would succeed because the department name would be different for that user.   A potential flaw would arise if the job failed and the index entry wasn't removed. Simplest solution would be a function that removed index entries based on a user name. Other solutions might be setting a condition handler or possibly a scope message that removed the entry for a job even if the function failed.   Tom
    125,585 pointsBadges:
    report
  • Cursorposition
    Thanks Tom.  Got some idea. 
    195 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