Page 1 of 1

March toolkit updates for all to try

Posted: Wed Mar 27, 2013 10:44 pm
by aseiden
Updates are here:
http://www.youngiprofessionals.com/wiki/XMLSERVICE

Try XMLSERVICE version 1.7.8, labeled "XMLSERVICE Server" in link above.
and the PHP Toolkit portion, v1.5.0, labeled "PHP Client" in link above.

These updates bring improved performance and more.

They updates are scheduled to be packaged in an official PTF from Zend. We invite everyone to try them now to enjoy the improvements, and to let us know asap if you have any issues.

PHP toolkit improvements since 1.4.0 in 1.5.0:

Code: Select all

1. Data areas:

1a. The default library when handling unqualified (no library given) data area names will now, for most operations, be *LIBL instead of *CURLIB. Before, *CURLIB was used all the time. *LIBL is in keeping with the usual, expected command defaults (CHGDTAARA, DSPDTAARA, et al.). The one exception, where *CURLIB will still be the default, is for the method createDataArea() and the CW function i5_data_area_create().  

Affected functions/methods: setDataAreaName() and the CW functions i5_data_area_read(), i5_data_area_write(), and i5_data_area_delete().

If your code relies on *CURLIB behavior, please specify *CURLIB explicitly rather than relying on the toolkit, because the toolkit has changed to use *LIBL most of the time. Users have told us that this is the expected behavior (and we agree).

1b. Fixed a bug where special data areas *LDA, *GDA, *PDA were getting a blank library (manifesting as an unwanted "/"). These should not have a library at all. 

http://forums.zend.com/viewtopic.php?f=113&t=106728

1c. Improved performance of readDataArea().

2. Data queues

2a. receiveDataQueue: correct spelling of method name
2b. receiveDataQueue: allow receive from non-keyed data queues
2c. several more more bug fixes

3. Transports

3a. Three new options under the new [transport] section in toolkit.ini:
; transport type allows configuration of transport from this INI. 
;transportType = "http" ; ibm_db2 is default. Other choices: "odbc", "http"
; for http transport only
;httpTransportUrl = "http://example.com/cgi-bin/xmlcgi.pgm"
 ; default plug size, which is the expected output size. 4K, 32K, 512K (default), 65K, 512K, 1M, 5M, 10M, 15M
 ; can also change in code with $conn->setOptions(array('plugSize' => '4K')); or desired size
;plugSize = "512K" 

These three can also be set via $conn->setOptions() in code. Example:
$conn->setOptions(array('transportType'    => 'http',
                        'httpTransportUrl' => 'http://my.cgi-enabled.ibm-i.com/cgi-bin/xmlcgi.pgm',
                        'plugSize'         => '4K'));

Explanation of these settings:
* transportType: an easier way to specify the transport than the previously used fourth parameter of getInstance(). The default is 'ibm_db2'. Also available are 'odbc' and the new, experimental (mostly works but not officially supported) 'http'.

* httpTransportUrl: if 'http' is the chosen transport, this is the place to specify the URL. 
To set up your server for HTTP/CGI look here:
 http://174.79.32.155/wiki/index.php/XMLService/XMLService
 and read the section: "Optional XMLSERVICE REST interface via RPG CGI (xmlcgi.pgm)" 

* plugSize: an easy way to change the default plug size, which is normally '512K'. If your data is basically small, try 4K. If you get an error that you suspect is because your data is bigger thank 512K, try a larger plug size. Then you can fine-tune it in your code with ->setOptions(array('plugSize'=>...whatever...));

3b. A note about the 'http' transport: if you use 'http' along with the compatibility wrapper (CW) and private connections, a bug will cause your connection to be disconnected at the end of every request unless you use the line: $conn->isPersistent(true). 

4. The debug log (when debug=true) now logs the database connection date/time and the amount of time needed to make the connection, if applicable. It also logs the transport type and related information.

5. Plug size is validated now. An exception will be thrown if an invalid plug size is supplied. 

6. Fixed a bug introduced in 1.4.0 that caused an error when reading spool files, job logs, and the system values list. The bug was related to a hard-coded plug size. 

7. New method: changeCurrentUser($user, $password), that "adopts authority" to a new user. It only works in 'stateless' mode at this time.

Usage:
// must be in stateless mode to adopt authority
$conn->setOptions(array('stateless' => true));
echo Job attributes before the change: <PRE>" . print_r($conn->getJobAttributes(), true) . '</PRE>';   
$success = $conn->changeCurrentUser('NEWUSR', 'NEWPW'); // ('*NOPWD' also allowed if job user has *USE rights to new user profile)
if ($success) {
    echo Job attributes AFTER the change: <PRE>" . print_r($conn->getJobAttributes(), true) . '</PRE>';
} else {
    echo 'Failed to change user: ' . $conn->getErrorCode() . ' ' . $conn->getErrorMsg();
}

8. Better error reporting. For example, a specific error will be shown if the user is missing the "LOB" PTF. More specific codes are also available for command and program errors.

9. New option: 'paseCcsid', which can be set both in toolkit.ini (under [system]) and  via setOptions().
; paseCcsid controls CCSID for <sh> type of functions such as WRKACTJOB ('system' command in PASE)
; Default is 819. Another practical value is 1208 (UTF-8).
;paseCcsid = 819	
Recent XMLSERVICE improvements in this release:

Code: Select all

   PERF — “stateless” PHP Toolkit improvement looping applications (8 seconds to 2 seconds) - Thanks Chris!
        PERFORMANCE — remove stop PASE during “stateless” calls for looping 

    PERF — private connect start/stop better average performance 

    NEW — ZENDSVR6 library (crtxml6)
    FIX — uncommon use XML DB2 CHGLIBL will no longer change CURLIB — Alan request
    FIX - error = ‘on|off|fast’
        FIX — most functions will return ‹success>+++…</success> and <error=‘on|off|fast’› as above — Alan request
        FIX — uncommon use XML DB2 error=‘on|off’ will return sqlcode, sqlstatus — Alan request
        FIX — uncommon use XML DB2 error <sqlstatus> is now <sqlstate> — Alan request
        FIX — uncommon use XML DB2 ‹sql> functions support error=‘on|off|fast’ — Alan request
            error=‘fast’ - xml script continues context <script><pgm or cmd or sql><error>…</pgm or cmd or sql></script> — no joblog (therefore fast error)
            error=‘on’ - xml script stops full <report><error>…<joblog>much text</joblog></report>
            error=‘off’ - xml script continues context <script><pgm or cmd or sql><error>…<joblog>subset text</joblog></pgm or cmd or sql></script> 
    FIX — DBCS convert characters PASE <sh>, toolkit CLInteractiveCommand() (Thanks Onoda-san!)

         problem -- hard coded 819 in plugpase.rpgle module changed to variable

        RAW XML Interface ...
        $ctl .= " *pase(1208)";

        Toolkit interface ...
        try { $ToolkitServiceObj = ToolkitService::getInstance($database, $user, $password); }
        catch (Exception $e) { die($e->getMessage()); }
        $ToolkitServiceObj->setToolkitServiceParams(
        array('InternalKey'=>$ipc,         // route to same XMLSERVICE job /tmp/myjob1
        'subsystem'=>"QGPL/QDFTJOBD",      // subsystem/jobd to start XMLSERVICE (if not running) 
        'plug'=>"iPLUG5M",                 // max size data i/o (iPLUG4K,32K,65K, 512K,1M,5M,10M,15M)
        'customControl' => '*pase(1208)'));// 1208 CCSID
        $Rows = $ToolkitServiceObj->CLInteractiveCommand("wrkactjob");
        if(!$Rows) die("Failure: ".$ToolkitServiceObj->getLastError());
        var_dump($Rows);
Thanks!
Alan Seiden

Re: March toolkit updates for all to try

Posted: Fri Mar 29, 2013 6:33 pm
by aseiden
Just posted a corrected 1.5.0 package to YiPs. The one I'd posted before was missing its CW subfolder. This one has it. Same filename: cw-tk-php-1.5.0.zip

Re: March toolkit updates for all to try

Posted: Wed Apr 03, 2013 8:54 pm
by jere9165
Ahhh, thank you for the update! My *LIBL wasn't working until now. Although I'm not sure the versions we had in place, I was told it was toolkit 1.4.0. Now I've got 1.7.8 and 1.5.0 and am good. Thank you!