ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

how to know Who is using a program?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to know Who is using a program?

    Dear all,

    How can I know that a program is being used by another user?
    I need to write a restriction if someone is using a certain program, the other user who is attempting to access the same option(program) will have a blocking message and he won't be able to access this program/option unless the other user exits this option/program

  • #2
    Re: how to know Who is using a program?

    Hi

    Allocate the program exclusively (*EXCL).
    If its the first job trying to allocate, it will be succesfull.
    Other jobs trying to allocate will receive message CPF1002.

    Code:
    ALCOBJ OBJ((MyLib/MyPGM *PGM *EXCL)) WAIT(1)
    MONMSG CPF1002 EXEC(DO)
     /* Already Allocated :  Do what you want ... */
    ENDDO
    
    /* Allocate successful .... do what you want */
    
    DLCOBJ OBJ((MyLib/MyPGM *PGM *EXCL))
    Jean-Michel

    Comment


    • #3
      Re: how to know Who is using a program?

      Thanks for the solution Jean Michel, But is there any other way?

      Comment

      Working...
      X