free RPG - how to call program in RPG

By kimot, 24 December, 2022
// declare variable for command

dcl-s cmd   varchar(100);

// declare QCMDEXC interface 

dcl-pr qcmdexc extpgm('QCMDEXC');      
  theCmd char(3000) const;             
  cmdLen packed(15 : 5) const;         
  dbcs char(3) const options(*nopass); 
end-pr;                      
          
// create command and run it 

cmd = 'STRBKUBRM CTLGRP(' + ctlgrp + ') SBMJOB(*NO)' ; 
qcmdexc (cmd : %len(cmd)) ;