ibm-midrangeibm-ifsibm-ilog-opl

How to fetch the User's Email Id in AS400?


I need to send a mail to the user that the job which is submitted has ended in error, for this how should i retrieve/fetch the email id of the user?


Solution

  • If you have defined the users email in the System Distribution Directory then you can retrieve the email with this RPG code:

    chain User_Name qaokl02a;                                  
    if %found;                                                 
      chain (wos1dden : machine) qatmsmtpa;                    
      if %found;                                               
        domroute = %xlate(up : lo : domroute);                 
        emailaddress = %trim(smtpuid) + '@' + %trim(domroute); 
      endif;
    endif;