We use a very old system at work to manage the most important parts of the business...I have no choice in this matter.
As a result, I have managed to get php's pdo driver working with the iSeriesAccess database driver, and so far as selecting and inserting goes, it works well enough with a few caveats not worth mentioning.
Using this code, I am unable to get a stored procedure that outputs to an OUT parameter to execute due to an error I have yet to solve.
$proc = $this->link->prepare("CALL QGPL.PROCNAMEHERE(\"*STRANGEPARAMNAMEHERE\",@output,' ')");
$proc->execute();
$proc->closeCursor();
$output = $this->link->query("select @output")->fetch(PDO::FETCH_ASSOC);
var_dump($output);
The resulting error:
Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 0 [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0206 - Column or global variable @OUTPUT not found.
I know that another individual in our company who writes in java successfully calls this procedure in his code, however I realize he probably has different drivers to use.
This problem is driving me mad, to the point I have tried manually calling it in DBeaver using a declared variable...which results in even stranger errors.
Using as suggested below, I get
Results in
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 0 [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0206 - Column or global variable *RTNORD not found. (SQLPrepare[0] at /build/php5-pO28mL/php5-5.5.9+dfsg/ext/pdo_odbc/odbc_driver.c:206)'