Calling procedures and service programs with the PHP Toolkit for IBM i

Calling procedures in RPG service programs, including getting the return value, is a powerful feature of the PHP Toolkit. The sample script below demonstrates how it’s done.

Note: Make sure your procedure name is 100% correct. It is case-sensitive. If you get an error, run the following command (replacing LIBNAME/PGMNAME with your library and program names) and look for your procedure name in the output. The command:
DSPSRVPGM SRVPGM(LIBNAME/PGMNAME) DETAIL(*PROCEXP)

The example below includes ‘boilerplate’ code to show best practices for connecting to the toolkit and checking for a successful connection. The illustration of how to call a procedure is in the second half.

For more information on the toolkit, see our toolkit information page or get in touch.