Help with example at "www.iprodeveloper.com"

General discussion on Zend Studio for IBM System i
Post Reply
giocot
Posts: 3
Joined: Thu Jul 19, 2012 9:17 am

Help with example at "www.iprodeveloper.com"

Post by giocot » Sat Sep 22, 2012 9:49 pm

Hi all

i'm trying to follow the example at the link "www.iprodeveloper.com/article/applicati ... rpg-699367";
1. I have installed XMLSERVICE
2. I have checked php.ini file includes “:/usr/local/ZendSvr/share/ToolkitApi”
3. I have Update /www/zendsvr/conf/httpd.conf file with the appropriate CCSID, then restarted Apache
4. I have created with Zend Studio e Php file in www/zendsvr/htdocs but:
In zend studion editor I see this errors:
1- Class 'ToolkitService' not found
2- CW style: Multiple annotations found at this line:- syntax error, unexpected 'style'
3- extract(i5_output()): Call to undefined function 'i5_output'
4- echo "Code: $CODE. Desc: $DESC"; Multiple annotations found at this line:- Undefined variable '$DESC'- Undefined variable '$CODE'


Can someone please, explain where i'm wrong ?

Thanks in advance

aseiden
Posts: 877
Joined: Thu Apr 09, 2009 5:45 pm

Re: Help with example at "www.iprodeveloper.com"

Post by aseiden » Sun Sep 23, 2012 5:48 am

The article shows two ways of using the toolkit: "new" style and CW (old) style. It looks like you are trying both at once.

Try the new toolkit style:

Code: Select all

// bring in the toolkit
require_once 'ToolkitService.php';

// connect (can also pass blank parameters to specify local database and default web user)
$conn = ToolkitService::getInstance('*LOCAL', 'MYUSER', 'MYPASS');
$conn->setToolkitServiceParams(array('stateless'=>true));
//or, for a private, stateful connection: $conn->setToolkitServiceParams(array('InternalKey'=>'/tmp/myusername'));

$code =  '1';
$desc = ''; // default to empty string
// create array of two 10-character alphanumeric parameters
$param[] = $conn->AddParameterChar('both', 10,'CODE', 'CODE', $code);
$param[] = $conn->AddParameterChar('both', 10,'DESC', 'DESC', $desc);

// call program
$result = $conn->PgmCall("COMMONPGM", "ZENDSVR", $param, null, null);

if($result) {   

    $outputParams = $result['io_param'];
    echo "Code: {$outputParams['CODE']}. Desc: {$outputParams['DESC']} ";

} else {
    echo "Error calling COMMONPGM.";
}
// The result should be Code: 1. Name: IBM

Post Reply