This function calls a program or procedure, exchanging parameter values.
array i5_XmlCallProgram (string Program_Name, array Input_Values [ , string Ret_Values_Var_Name ] [ , resource Connection ])
Parameters
program_name |
Program or Procedure name. This name is a virtual name. Real program or procedure name is given in the prototype. See Calling Programs or Procedures example. To call a procedure from a service program, first, you need to bind the service program to the current Easycom job, call function i5_XmlBindSrvPgm.
|
input_values |
Input values in an associative array.
|
ret_values_var_name |
When a procedure from a service program is called, it can
return a return value, in addition to output parameters.
|
connection |
Easycom Connection - Result of i5_connect() or i5_pconnect(). |
Return
If function succeeds, it returns an associative array with output parameter values.
False is returned if error.
Details
This function calls a native IBM i program or procedure, whose prototype was previously loaded by a previous call to i5_XmlDefine, or i5_XmlLoadDefinition.
Parameter values on input and output are passed using associative arrays.
Examples
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);
if (is_bool ( $ArrayOut ) && $ArrayOut == FALSE)
{
print_r("i5_XmlCallProgram error : ".i5_errormsg().'<br/>');
}
else
{
echo '<p>Param 1='. $ArrayOut['PARM1'].'</p>';
echo '<p>Param 3, Member 3='. $ArrayOut['PARM3']['MBR3'].'</p>';
}
See also