Call i Function from PHP

General discussion on Zend Server for IBM System i
Post Reply
Posts: 11
Joined: Tue Feb 05, 2013 5:46 pm

Call i Function from PHP

Post by michaelryan » Tue Feb 05, 2013 5:54 pm

I want to use a function on the i for validation in my PHP program. I'm trying this:

$SQLStmt = "SELECT * from sysibm.sysdummy1 where NEWSYS.MSP_ValidateInvoiceTypeFN($Wk_Store) = 1";
$stmt = db2_exec($db2connection, $SQLStmt) or die("Failed SQL Stmt:".$SQLStmt.":".db2_stmt_error().":".db2_stmt_errormsg());

and I get a 'statement failed' in php.log.

I get this: MSP_VALIDATEINVOICETYPEFN in NEWSYS type *N not found. SQLCODE=-204 in db2errormsg.

This function (MSP_VALIDATEINVOICETYPEFN) is a procedure in service program MSPSRVPGM.

I can see the function in System i Navigator. I can call the function from an RPG program using embedded SQL.

I'd rather not use a stored procedure (rather not have to prepare, param, etc.) for a simple validation.

What am I doing wrong?


Post Reply