Warning: i5_program_call(): Invalid pointer (handle), (null)

General discussion on Zend Core for IBM System i
Post Reply
conexionpy
Posts: 2
Joined: Wed Aug 12, 2009 12:18 am

Warning: i5_program_call(): Invalid pointer (handle), (null)

Post by conexionpy » Tue Jan 05, 2010 10:14 pm

What is wrong with this simple code? Always return a Invalid pointer error.

Code: Select all

<?php


$conn = i5_connect("192.168.8.12","USER","PWD")

    or die(i5_errormsg());

echo " Connection OK <BR>";

$params = array('055@1155058822@14.59.09@4@1@1@000000005@000@00002@60@I@','S10E5093');

$prog = i5_program_prepare("MYLIB/MYPGM");

$res=i5_program_call($prog, $params); 
//if(i5_program_call($prog)) { 

if ($res){
$result = i5_fetch_assoc($prog);
print_r($result);//i

} else { 

var_dump($res);
print_r(i5_error());
print "Program call failed.<br>";

}

?>

Results:

Code: Select all

 Connection OK <BR>
Warning: i5_program_call(): Invalid pointer (handle), (null) in /home/CARLOSRD/i5_php/test3.php on line 15
bool(false)
Array
(
    [0] => 4
    [1] => 9
    [2] => Invalid pointer (handle), (null)
    [3] =>
    [num] => 4
    [cat] => 9
    [msg] => Invalid pointer (handle), (null)
    [desc] =>
)
Program call failed.<br>$

scottgcampbell
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Warning: i5_program_call(): Invalid pointer (handle), (null)

Post by scottgcampbell » Wed Jan 06, 2010 4:31 pm

I think you need to include a description for the i5_program_prepare

Code: Select all

// You need to create the description of the parms for your program e.g.
$desc =  array(
	array("Name"=>"PARM1", "IO"=> I5_INOUT, "Type"=>I5_TYPE_CHAR, "Length"=>"20"),
	array("Name"=>"PARM2", "IO"=> I5_INOUT, "Type"=> I5_TYPE_CHAR, "Length"=>"10")	
);

prog = i5_program_prepare("MYLIB/MYPGM",$desc);

Scott

jratcliffe
Posts: 1
Joined: Fri Aug 31, 2012 11:22 pm

Re: Warning: i5_program_call(): Invalid pointer (handle), (n

Post by jratcliffe » Fri Aug 31, 2012 11:28 pm

bumping this thread... i'm getting the same error even after specifying a description:

ERROR: i5_execute error! i5_error=(Array ( [0] => 4 [1] => 9 [2] => Invalid pointer (handle), (null) [3] => [num] => 4 [cat] => 9 [msg] => Invalid pointer (handle), (null) [desc] => ) ), i5_errormsg=(Invalid pointer (handle), (null))

// Get a connection to the iSeries, or reuse the one that is currently open
if ('' == $err) {
//$i5_connection = i5_pconnect('', '', '', array(I5_OPTIONS_DECIMALPOINT => "."));
$i5_connection = i5_pconnect('', '', '');
if (!$i5_connection) {
$err = 'Error connecting to the i5!';
}
}

// Prepare program
if ('' == $err) {
$description = array (
array ("Name"=>"P1", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1),
array ("Name"=>"P2", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>3),
array ("Name"=>"P3", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>7),
array ("Name"=>"P4", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>4),
array ("Name"=>"P5", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>3),
array ("Name"=>"P6", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P7", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P8", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>8),
array ("Name"=>"P9", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P10", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>3),
array ("Name"=>"P11", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1),
array ("Name"=>"P12", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P13", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1),
array ("Name"=>"P14", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>2),
array ("Name"=>"P15", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P16", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1),
array ("Name"=>"P17", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>6),
array ("Name"=>"P18", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1),
array ("Name"=>"P19", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>3),
array ("Name"=>"P20", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>1)
);

$prog = i5_program_prepare("LIBL/PROG1SK", $description);
if (!$prog) {
$err = "Unable to Prepare the program!";
}
}

// Call program
if ('' == $err) {
$input_args = array(
"P1" => "'Y'",
"P2" => "'990'",
"P3" => "'7000200'",
"P4" => "'B011'",
"P5" => "'001'",
"P6" => "'003.25'",
"P7" => "'ISSGS'",
"P8" => "'20120830'",
"P9" => "'175655'",
"P10" => "'800'",
"P11" => "'N'",
"P12" => "'13.111'",
"P13" => "'N'",
"P14" => "'RR'",
"P15" => "'00.250'",
"P16" => "'N'",
"P17" => "'00.000'",
"P18" => "'0'",
"P19" => "'000'",
"P20" => "'N'",
);

$return_val = i5_program_call($prog, $input_args);
if (!$return_val) {
$err = "i5_execute error! i5_error=(" . print_r(i5_error(), true) . "), i5_errormsg=(" . i5_errormsg() . ")";
}
}

i've tried wrapping the parameter values with and without single quotes... same results... can anyone provide any insight as to why i'm getting this invalid pointer error? i've searched everywhere and can't find a solution... the only thing different about this RPG call than previous ones in my script is that this one has 20 parameters instead of <5... is there a default parameter limit set somewhere?

alex4065
Posts: 8
Joined: Thu Jan 11, 2018 4:22 pm

Re: Warning: i5_program_call(): Invalid pointer (handle), (n

Post by alex4065 » Thu Jan 11, 2018 5:09 pm

thanks for the share. it has been a huge help to my project. not quite sure i would be able to finish it up without your code

Post Reply