zosrexxomvs

Getting BPXWUNIX to use the users .profile along with the /etc/profile?


Here is my sample code which works with BPXWUNIX and uses the /etc/profile but I can see no way to get the users .profile to be included. As you can see the login flag is set (that is the 1 at the end of the bpxwunix parameter string.

/* rexx */       
/* pass as an argument any OMVS command (i.e. env) */                               
parse arg cmd     
/* now get the users home (pwd) location */                              
address syscall 'getpwnam' sysvar('sysuid') 'h.'
/* place into the environment stem as HOME */
env.1 = 'HOME='h.4                              
env.0 = 1    
/* echo out the home and full command now */                                   
say 'home:' env.1                               
say 'cmd:' cmd  
/* issue the bpxwunix call */                                
x = bpxwunix(cmd,,s.,e.,env.,1)   
/* view the results */              
call stemedit 'view','s.'                       
call stemedit 'view','e.'                       

I'm using stemedit from www.cbttape.org file 895 to view the stdout and stderr stems.


Solution

  • This is a working answer:

    /* rexx */                                              
    /* process the omvs command to execute */               
    parse arg cmd                                           
    /* get the users home directory (pwd) */                
    address syscall 'getpwnam' sysvar('sysuid') 'h.'        
    /* put into the bpxwunix environment variable */        
    env.1 = 'HOME='h.4                                      
    env.0 = 1                                               
    /* issue the bpxwunix command */                        
    x = bpxwunix(cmd,,s.,e.,env.,1)                         
    /* view results using stemedit from cbttape file 895 */ 
    call stemedit 'view','s.'                               
    call stemedit 'view','e.'