ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to monitor for possible errors

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

  • #16
    I like that... are those API's prototyped anywhere (preferrably in free-format)?

    Actually... how will this work if I don't know each user's password??
    Last edited by gwilburn; March 19, 2019, 02:52 PM.

    Comment


    • #17
      You can swap to a user without knowing their password if you have sufficient authority. (Which you must already have if you can use SBMJOB with their profile.)

      They aren't prototyped by IBM, you have to write your own (or find one on the web). These are very simple APIs, its very easy to write the prototypes. I typically just re-write the prototypes each time I need them since it's quicker than finding where I prototyped them last time. (I know, I know, I should be more organized!)

      Comment


      • #18
        Also, there's a caveat when using these APIs to create spooled files. Spooled files normally contain the whole job id, and when you swap profiles, the job id doesn't change. So for security reasons, it will generate the spooled file under a separate job name. (But, it will be the correct user profile.)

        Comment


        • #19
          To ensure that you always swap back to the original profile before your program ends, code those final calls in the ON-EXIT section of your procedure.

          Code:
          dcl-proc whatever;
             // get profile handle  
             QSYGETPH ...
          
             // set new user profile
             QWTSETP
          
             ...
          
          on-exit:
             // restore original profile
             QWTSETP ...
             // release profile handle
             QSYRLSPH ...
          end-proc;

          Comment


          • #20
            Thanks Scott and Barbara! This is very promising.

            Scott - I found prototypes in on of your presentations: https://www.scottklement.com/rpg/socktut/valuserid.html

            Barbara - thanks for the heads up. I found a descent example here http://www.rpgiv.info/mambo/index.ph...d=638&Itemid=9

            Comment

            Working...
            X