Is your CL program making calls that rely on a library list having been
set?
Here's one way to do that:
$conn = i5_connect("localhost", "$USER", "$PASSWORD", array(
I5_OPTIONS_INITLIBL=>'FOOLIB BARLIB ETCLIB' ) ) or die( "Connection error
is :" . i5_errormsg());
Alfred
--
Alfredo Delgado / Web Development
6800 Broken Sound Pkwy, Suite 150
Boca Raton, Florida 33487
-----web400-bounces@xxxxxxxxxxxx wrote: -----
To: <web400@xxxxxxxxxxxx>
From: "Pete Wood" <acedanger49@xxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
Date: 10/24/2009 09:39
Subject: [WEB400] Calling a CL program from PHP
I've got the following PHP code, to call a CL program with 4 parameters.
The
first 2 parms are "input" and the last two are "output" from the CL
program.
The CL program is being called but it returns a status code of "not
found"
for that particular user id. I am able to call the same CL program from
a
LANSA Web program, passing the same user id and password combination as
in
the PHP script, the difference being that my CL program validates the
user
id and password when called from my LANSA Web program.
Am I missing something on my program call? How can I go about debugging
this
to figure out what's going on?
<?php
$conn = i5_connect("localhost", "$USER", "$PASSWORD") or die(
"Connection
error is :" . i5_errormsg());
$desc = array (
array ( "name"=>"userid",
"io"=>I5_INOUT,
"type" => I5_TYPE_CHAR,
"length"=> "10"),
array ( "name"=>"password",
"io"=>I5_INOUT,
"type" => I5_TYPE_CHAR,
"length"=> "10"),
array ( "name"=>"usrhndl",
"io"=>I5_INOUT,
"type" => I5_TYPE_CHAR,
"length"=> "12"),
array ( "name"=>"sts",
"io"=>I5_INOUT,
"type" => I5_TYPE_CHAR,
"length"=> "2")
);
// Prepare Program
$prog = i5_program_prepare("PRODOBJ/VALID8USER", $desc) or die("FAIL :
i5_program_prepare<br />\n".i5_error());
// Execute Program
$input = array( "userid"=>$inpUser,
"password"=>$inpPwd,
"usrhndl"=>"",
"sts"=>""
);
$output = array( "userid"=>"user",
"password"=>"pass",
"usrhndl"=>"usrhndl",
"sts"=>"sts"
);
$ret = i5_program_call($prog, $input, $output) or die("FAIL :
i5_program_call<br />".i5_error());
if ($ret === TRUE) {
echo "<br />The return values are - <br />Status:
<strong>".$sts."</strong><br />User handle for user
<strong>".$user."</strong> is <strong>".$usrhndl."</strong> <br />";
}
$close_val = i5_program_close($prog) or die("FAIL : i5_program_close<br
/>\n".i5_error());
i5_close($conn);
?>
Thanks in advance for any help,
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [1]
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [2]
http://archive.midrange.com/web400.
References
Visible links
1.
http://lists.midrange.com/mailman/listinfo/web400
2.
http://archive.midrange.com/web400
As an Amazon Associate we earn from qualifying purchases.