free RPG - find out Job name / user / number

By kimot, 24 December, 2022

If you want to find out qualified job name in RPG for subsequent use :

dcl-pr QUSRJOBI extpgm;             
  *n  char(32766) options(*varsize);
  *n  int(10:0) const;              
  *n  char(8) const;                
  *n  char(26) const;               
  *n  char(16) const;               
end-pr;                             
                                    
dcl-ds Job len(86) qualified inz ;  
 Name  char(10) pos(9) ;         
 User   char(10) pos(19) ;        
 Number   char(6)  pos(29) ;        
end-ds ;                            

QUSRJOBI(Job:%size(Job):'JOBI0100':'*':'') ;

Variables Job.Name, Job.User, Job.Number will contain requested information.