I have created a test program that receives two 10 byte char fields, and in the procedure returns a 20 byte field that concatenates the two input fields together (original huh). I have tested on the iSeries and it works as designed.
I have the following code
- Code: Select all
include_once 'ToolkitService.php';
try {
$ToolkitServiceObj = ToolkitService::getInstance('SYSTEMNANME', 'USERID', 'PASSWORD');
}
catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
$ToolkitServiceObj->setToolkitServiceParams(array('InternalKey'=>"/tmp/USERID"));
$param[] = $ToolkitServiceObj->AddParameterChar('both', 10,'Parameter1','parm1', 'Ken');
$param[] = $ToolkitServiceObj->AddParameterChar('both', 10,'Parameter2','parm2', 'Berg');
$OutputParams = $ToolkitServiceObj->PgmCall('SP_MODWR', "KEN", $param, NULL, array('func'=>'MODWRETURN') );
echo 'Output Parameters: '.$OutputParams;
The RPGLE module code is very simple
- Code: Select all
H NoMain
// prototype for pgmwentry
D ModWReturn PR 20
D Parm1 10
D Parm2 10
*----------------------------------------------------
P ModWReturn B EXPORT
// *entry interface for main procedure
D ModWReturn PI 20
D Parm1 10
D Parm2 10
// stand alone values
D ReturnVal S 20
/Free
returnVal = parm1 + parm2;
*INLR = *ON;
return returnVal;
/End-Free
P ModWReturn E
When I run this in debug I get into the program on the iSeries, see both input variables, see the combining of the values and show that I return it (saw this debugging in an iSeries program as well). At this point though I see the error "Pointer not set for location referenced. " in the XTOOLKIT job that is running under my profile.
The documentation shows that the 4th parm for the PgmCall function is the return value. I have tried to put a variable in this rather than NULL both as an array, and just a variable with no luck either.
Hope someone has seen this before. One of the things about the Toolkit that has exited me was the ability to call functions and receive back values other than integers.

