|
On Apr 4, 2016, at 4:27 PM, Matt Lavinder <mlavinder@xxxxxxxxxxxxxxxxxxx> wrote:
You need to look at the Toolkit.
http://files.zend.com/help/Zend-Server-8-IBMi/zend-server.htm#the_pgmcall__method.htm
There is a compatibility-wrapper to make some of the old i5 functions work,
but since you seem to be learning this for the first time, it is probably
better to learn how to do this using the Toolkit. The
compatibility-wrapper is useful to keep existing code from breaking.
I tried to adapt the example you sent. Hopefully this will get you started
with the toolkit. Here is the link to the Zend Server 8 documentation (
http://files.zend.com/help/Zend-Server-8-IBMi/zend-server.htm). It
includes a Toolkit reference.
<?php
include_once 'ToolkitService.php';
$db='*LOCAL';
$user='';
$password='';
$extension='ibm_db2';
try {
$ToolkitServiceObj = ToolkitService::getInstance($db, $user, $pass,
$extension);
}
catch (Exception $e) {
echo $e->getMessage() . "\n";
exit();
}
$ToolkitServiceObj->setToolkitServiceParams(array('InternalKey'=>"/tmp/$user"));
// this assumes these are the values you want to pass the program
$type = 'OC';
$email = 'test@xxxxxxxxxxx';
$customer = 'CAABBMAS';
$param[] = $ToolkitServiceObj->AddParameterChar('in', 2,'Type', 'type',
$type);
$param[] = $ToolkitServiceObj->AddParameterChar('in', 40,'Email', 'email',
$email);
$param[] = $ToolkitServiceObj->AddParameterChar('both', 11,'Email',
'customer', $customer);
$result = $ToolkitServiceObj->PgmCall("ZMR950S", "ZTT1420CP", $param, null,
null);
if($result){
echo "<BR>TYPE : " . $result['io_param']['type'];
echo "<BR>EMAIL : " . $result['io_param']['email'];
echo "<BR>CUSTOMER : " . $result['io_param']['customer'];
}
else
echo "Execution failed.";
/* Do not use the disconnect() function for "state full" connection */
$ToolkitServiceObj->disconnect();
On Mon, Apr 4, 2016 at 12:37 PM, PACHECO, Mauricio <
mauricio.pacheco@xxxxxxxxxxxxxx> wrote:
Thanks, this is the rest of the program. However I couldn't find a "$ret =
i5_program_call($pgm, $parmIn, $parmOut);" to test under IBM DB2 for PHP.
$description = array(
array("Name"=>"TYPE", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>"2"),
array("Name"=>"EMAIL", "IO"=>I5_IN, "Type"=>I5_TYPE_CHAR, "Length"=>"40"),
array("Name"=>"CUSTOMER", "IO"=>I5_OUT, "Type"=>I5_TYPE_CHAR,
"Length"=>"11")
);
$pgm = i5_program_prepare("ZTT1420CP/ZMR950S", $description);
if (!$pgm) die("<br>Program prepare error. Error number
=".i5_errno()."msg=".i5_errormsg());
$parmIn = array(
"TYPE"=>$_POST["OC"],
"EMAIL"=>$_POST["test@xxxxxxxxxxx "],
"CUSTOMER"=>$_POST["CAABBMAS "]
);
$parmOut = array(
"TYPE"=>"TYPE",
"EMAIL"=>"EMAIL",
"CUSTOMER"=>"CUSTOMER"
);
$ret = i5_program_call($pgm, $parmIn, $parmOut);
if (!$ret) die("<br>Program call error. Error
number=".i5_errno()."msg=".i5_errormsg());
echo "<BR>TYPE : $TYPE";
echo "<BR>EMAIL : $EMAIL";
echo "<BR>CUSTOMER : $CUSTOMER";
/* Close program call */
i5_program_close($pgm);
Thanks,
*Mauricio Pacheco*
Systems Architect
*To see my calendar availability click here
<
https://www.google.com/calendar/embed?src=mauricio.pacheco%40airliquide.com&ctz=America/Toronto&mode=week
| Cliquez ici
<
https://www.google.com/calendar/embed?src=mauricio.pacheco%40airliquide.com&ctz=America/Toronto&mode=week
pour
voir mon agenda*
6990 Creditview Road,
Mississauga, ON L5N 8R9
Tel: (905) 855 0414 x 1102 - Mobile: (905) 601 4944
mauricio.pacheco@xxxxxxxxxxxxxx
www.vitalaire.com
[image: VitalAire Canada Inc.] <https://www.vitalaire.com>
On Mon, Apr 4, 2016 at 12:09 PM, Matt Lavinder <
mlavinder@xxxxxxxxxxxxxxxxxxx> wrote:
I think that is based on an old example. The i5 functions no long existsmsg=".db2_conn_errormsg
and were removed several version ago. You need to use the db2 functions(
http://php.net/manual/en/book.ibm-db2.php).
$conn = db2_connect("*LOCAL", "TESTPHP", "PASSPHP1") or
die(db2_conn_errormsg());
if (!$conn) die("<br>Connection using \"localhost\" with USERID and
PASSWORD failed. Error number =".db2_conn_error()."
())."<br>";also
else echo "<br>Connection using \"localhost\" with USERID and PASSWORD
OK!<br>\n";
/* Close connection */
db2_close($conn);
Also, one other thing to note...
While you are free to create a user and use it, the following code may
work:username
db2_connect("*LOCAL", "", "");
If I am not mistaken, this will cause PHP to use QTMHHTTP user when
database calls are performed from HTTP jobs. Obviously, if you have very
strict access control in place for you your database, that may not work.
Still, it is worth mentioning as some would argue it is more secure.
One big plus is you don't have to remember to remove or change the
and password whenever you post examples online.https://www.google.com/calendar/embed?src=mauricio.pacheco%40airliquide.com&ctz=America/Toronto&mode=week
On Mon, Apr 4, 2016 at 9:32 AM, PACHECO, Mauricio <
mauricio.pacheco@xxxxxxxxxxxxxx> wrote:
I just installed ZEND v8.0 over AS/400 V6R1. It looks like I am missing"*Fatal
something, which I don't know. Thanks in advanced!
I am trying to call a program thru PHP, but I am getting the error
error*: Call to undefined function i5_connect() inmsg=".i5_errormsg())."<br>";
*/usr/local/zendsvr6/var/apps/http/
192.168.0.36/10080/_docroot_/test/callpgm.php
<http://192.168.0.36/10080/_docroot_/test/callpgm.php>* on line *4*"
<HTML>
<?php
/* Connect to server */
$conn = i5_connect("localhost", "TESTPHP", "PASSPHP1") or
die(i5_errormsg());
if (!$conn) die("<br>Connection using \"localhost\" with USERID and
PASSWORD failed. Error number =".i5_errno()."
else echo "<br>Connection using \"localhost\" with USERID and PASSWORD
OK!<br>\n";
/* Close connection */
i5_close($conn);
?>
</HTML>
Thanks,
*Mauricio Pacheco*
Systems Architect
*To see my calendar availability click here
<
https://www.google.com/calendar/embed?src=mauricio.pacheco%40airliquide.com&ctz=America/Toronto&mode=week| Cliquez ici
<
mailingpour
voir mon agenda*
6990 Creditview Road,
Mississauga, ON L5N 8R9
Tel: (905) 855 0414 x 1102 - Mobile: (905) 601 4944
mauricio.pacheco@xxxxxxxxxxxxxx
www.vitalaire.com
[image: VitalAire Canada Inc.] <https://www.vitalaire.com>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
--list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
*Matt Lavinder Programmer AnalystData Management Inc.Phone: (336)
573-5045Fax: (336) 573-5001*
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
--
*Matt Lavinder Programmer AnalystData Management Inc.Phone: (336)
573-5045Fax: (336) 573-5001*
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.