ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Changing user on an active interactive job

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

  • Changing user on an active interactive job

    I am trying to change the user id an an active interactive job. The interactive job is being spawned from plex with a generic user id. I can do a rtvjoba and see the actual user id on the current user parm. I thought the QWTSETP API would work, but it requires a password and I won't have the password. Is it possible to change the user id of an active job? Thanks in advance!

  • #2
    QWTSETP does change the userid.

    But... You cannot change the userid in the job name. Job names are something like 123456/MYUSERID/JOBNAME -- and lots of stuff in the system is tracking and managing that job by that name. If that name were to change, everything would go haywire. So, if you change the user name with QWTSETP (or any of the other various ways) the job name will NOT change, it will continue to show MYUSERID in the job name. However, the job's current user will change, and authorities will use the new userid, etc. QWTSETP (and similar tools) change the userid everywhere EXCEPT in the job name.

    Notice that the RTVJOBA has two blanks for the userid:
    Code:
    RTVJOBA USER(&USER)      <-- this gets the userid from the job name
    
    RTVJOBA CURUSER(&USER)   <-- this gets the userid set by QWTSETP
    Likewise, RPG programs that use a program status data structure (SDS) have two fields in them, one for the current user, and one for the userid in the job name.

    As long as you update your programs to use the current user (which is almost certainly the "right" way to write your code -- unless, of course, you are explicitly getting the userid in order to use it to refer to the job name) everything should work fine with QWTSETP and similar routines.

    Comment


    • #3
      As to the question about using the API without knowing the password - that's possible by using the *NOPWDCHK special value for the password parameter when using the QSYGETPH API to obtain the profile handle. *USE authority to the profile is needed.

      Cheers,

      Emmanuel

      Comment


      • #4
        QSYGETPH (and QSYGENPT) actually have 3 different values for getting handles (or tokens) without knowing the password. *NOPWD, *NOPWDCHK and *NOPWDSTS. They vary slightly in which state the profiles have to be in in order to work. There are some other caveats as well (such as the number of parameters that are required) so its best to just look them up in the docs and read about them. https://www.ibm.com/support/knowledg...s/QSYGETPH.htm

        Comment

        Working...
        X