This function calls a program or procedure, exchanging parameter values.
|
array i5_XmlCallProgram ( |
string Program_Name
|
This function combines i5_XmlCrtPgmRequest, i5_XmlSetInputValue, i5_XmlExecrequest and i5_XmlGetOutputValue.
Parameter values on input and output are passed using associative arrays.
|
Program_Name |
Name of the program or procedure to call. This name is a virtual name. Real program or procedure name is given in the prototype. See Calling Programs or Procedures example.
|
|
Input_Values |
Input values in an associative array.
|
|
Ret_Values_Var_Name |
When a procedure from a servive program is called, it can return a return value, in addition to output parameters.
|
|
Connection |
Easycom Connection - Result of i5_connect() or i5_pconnect(). |
Returns:
If function succeeds, it returns an associative array with output parameter values.
Calling a a program with no return value. Only output parameters are retrieved.
// Define SAMPLESDS1 procedure prototype
$SRPG = "DS_A DS;
MBR1 10a;
MBR2 10a;
MBR3 8p2;
SampleDS1 PR extpgm(SampleDS1);
PARM1 10a;
PARM2 8p2;
PARM3 likeds(DS_A);";
i5_XmlDefine ("s-rpg", $SRPG);
// Call it!
$ArrayIn = array("PARM1"=>"pararm 1", "PARM2"=>12345, PARM3"=>array("MBR1"=>"Param 3-1"));
$ArrayOut = i5_XmlCallProgram("SAMPLEDS1", $ArrayIn);
echo '<p>Param 1='. $ArrayOut['PARM1'].'</p>';
echo '<p>Param 3, Member 3='. $ArrayOut['PARM3']['MBR3'].'</p>';
Calling a procedure returning a DS.
// Define FSPCUST procedure. Procedure is in SRVPTEST1 service program.
// FSPCUST returns a DS.
$SRPG = "DS_CUST E DS extname(SP_CUST);
FSPCUST PR LIKEDS(DS_CUST);
TERM1 5S 0;";
$XMLStr = i5_XmlDefine ("s-rpg", $SRPG
i5_XmlBindSrvPgm ("SRVPTEST1");
$ArrayIn = array("TERM1"=>1551);
$ArrayOut = i5_XmlCallProgram ("FSPCUST", $ArrayIn, "RetVal");
echo '<p>Return Value=';
var_dump($RetVal);
echo '</p>';