Opens a Program or Procedure and prepares it to be run.
|
resource i5_program_prepare ( |
(string name |
|
name |
Program name.
For a call to a Procedure in a Service Program, the procedure name is given in parentheses, e.g., Lib/Service_Program(PROC)
|
|
description |
PHP-format program description. This should be provided if the program is not described on server. See: PHP Data Description
|
|
connection |
Result of i5_connect
|
Returns:
Resource if open succeeded, false if open failed.
|
I5_ERR_DESC_WRONG_DATAOP |
41 |
Wrong operation on a data field of a description |
|
I5_ERR_PARSEXML |
42 |
Internal error; please contact Aura Equipement; error number 42 |
|
I5_ERR_PHP_OPTIONSTYPE |
259 |
The type of " I5_OPTIONS_ALIAS" option must be x and not x |
|
I5_ERR_PHP_OPTIONSNUMBER |
260 |
Option number -1 is unknown. |
|
I5_ERR_PHP_TYPEPARAM |
262 |
Type of element x in parameter -1 must be y. Type z was provided. |
|
I5_ERR_PHP_VARIABLE |
281 |
You can't use the I5_bind_param function and specify parameters |
|
I5_ERR_PHP_ALREADY_PGMNAME |
284 |
You cannot call this function; because it was already called or x was called. |
|
I5_ERR_PHP_PRIVATE_CONNECTION_NOT_FOUND |
285 |
the -1 connection has not been found. |
|
I5_ERR_PHP_GET_SYSVAL |
297 |
The command returned an error: x. |
|
I5_ERR_PHP_BAD_DS_INPUT |
308 |
Values for 'Data Structure' parametre -1 does not match the description. |
/*Call a program passing a data structure as parameter */
/* 4th parameter is a DS */
$description = array (
array ("Name"=>"P1", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>10,
"Count"=>5),
array ("Name"=>"P2C", "IO"=>I5_INOUT,"Type"=>I5_TYPE_LONG, "Length"=>4),
array ("Name"=>"P2", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>1,
"CountRef"=>"P2C" ),
array ("DSName"=>"PS", "Count"=>2, "DSParm"=>array (
array ("Name"=>"PS1", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>10),
array ("Name"=>"PS2", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>10),
array ("Name"=>"PS3", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>10)
)
)
);
$hdlPgm = i5_program_prepare("EASYCOM/RPCTEST", $description);
$Psparameter = array(
array("PS1"=>"test1", "PS2"=>"test2", "PS3"=>"test3"),
array("PS1"=>"test3", "PS2"=>"test4", "PS3"=>"test5")
);
$parameter2 = Array(
"P1"=>array("t1", "t2", "t3", "t4", "t5"),
"P2C"=>2,
"P2"=>array("a", "b"),
"PS"=>$Psparameter
);
$parmOut2 = array("P1"=>"P1", "PS"=>"PS");
$ret = i5_program_call($hdlPgm, $parameter2, $parmOut2);
if (!$ret){
print_r(i5_error());
trigger_error("i5_execute error : ".i5_errormsg(), E_USER_ERROR);
}
echo "P1 : $P1<BR>";
echo "PS: ";print_r($PS);echo "<BR>";
/*Call program with simple parameters*/
$description = array (
array ("Name"=>"OP1", "IO"=>I5_IN, "Type"=>I5_TYPE_PACKED, "Length"=>"5.2"),
array ("Name"=>"STR1", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>20),
array ("Name"=>"OP2", "IO"=>I5_INOUT, "Type"=>I5_TYPE_PACKED, "Length"=>"5.2"),
array ("Name"=>"STR2", "IO"=>I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>30),
array ("Name"=>"OP3", "IO"=>I5_OUT, "Type"=>I5_TYPE_PACKED, "Length"=>"10.4")
);
$hdlPgm = i5_program_prepare("EASYCOM/RPCSAMPLE", $description);
$parameterIn = Array("OP1"=> 10.1, "STR1"=>"Hello", "OP2"=> 20.2, "STR2"=>"test");
$parameterOut = array("OP2"=>"parmOperator2", "STR2"=> "parmString2");
$ret = i5_program_call($hdlPgm, $parameterIn, $parameterOut);
if (!$ret){
print_r(i5_error());
trigger_error("i5_execute error : ".i5_errormsg(), E_USER_ERROR);
}
echo "Parameter 3(P1+ P3, 10.1 + 20.2) : $parmOperator2<BR>";
echo "Parameter 4(P2), Hello : $parmString2<BR>";