title: How can you call programs from a stored procedure?
body: <p>I have followed other examples on stack exchange to call a built-in program from a stored procedure, but continue to get an error.</p>
  
  <p>Working off this example (<a href="https://stackoverflow.com/questions/27681270/looking-for-a-working-example-of-any-os-400-api-wrapped-in-an-external-sql-store">Looking for a working example of any OS/400 API wrapped in an external SQL stored procedure wrapped in a user defined SQL function</a>) I built the following to attempt to create a wrapper command to allow me to change object security (my issue is that objects I create, regardless of library) are not always accessible to others in my some function, I must manually set to a common security group.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE XX.TST( IN XOBJ CHAR(32), IN XOBJTYPE CHAR(10), IN XNEWOWN CHAR(10))
  
  LANGUAGE CL
  
  SPECIFIC XX.TST
  
  NOT DETERMINISTIC
  
  NO SQL
  
  CALLED ON NULL INPUT
  
  EXTERNAL NAME 'QSYS/CHGOBJOWN'
  
  PARAMETER STYLE GENERAL;
  
  CALL XX . TST('XX/TBL1','*FILE','GRPFRIENDS');
  </code></pre>
  
  <p>I get the following error: </p>
  
  <blockquote>
    <p>External program CHGOBJOWN in QSYS not found</p>
  </blockquote>
  
  <p>But have confirmed that going to the CL of the terminal emulator and typing QSYS/CHGOBJOWN takes me into the parameter input screen</p>