QSPRILSP API Call fails

QSPRILSP API Call fails

Postby cbeck on Wed Jan 30, 2013 5:05 pm

I am trying to use the QSPRILSP API via the toolkit but the xml returned is chopped off causing simplexml_load_string() to fail.

Any ideas?

Here is my test program:
Code: Select all
<?php
require_once 'ToolkitService.php';

$debugLog = realpath(dirname(__FILE__)) . '/debug.log';
@unlink($debugLog);

$toolkit = ToolkitService::getInstance();
$toolkit->setToolkitServiceParams(array('stateless' => true ,
                              'debug' => true,
                              'debugLogFile' => $debugLog
                              ));

if ($toolkit->ClCommand('DSPLIBL OUTPUT(*PRINT)')) {

   $param = array();
   $param[] = $toolkit->AddParameterChar('out',70, 'data','data', '');
   $param[] = $toolkit->AddParameterInt32('in', 'len','len', 70);
   $param[] = $toolkit->AddParameterChar('in', 8, 'format','format','SPRL0100');
   $param[] = $toolkit->AddErrorDataStruct();

   $result = $toolkit->PgmCall("QSPRILSP", "*LIBL", $param);

   echo '<pre>Result: ';
   var_dump($result);
   echo '</pre>';
   echo '<xmp>Debug Log: ' . file_get_contents($debugLog) . '</xmp>';

} else {
   echo('Failed to create spool file');
}


Here is the output - minus the warnings:
Code: Select all
Result: bool(false)
Debug Log:
Exec start: 2013-01-30 10:03:32
Version of toolkit front end: 1.4.0
IPC: ''. Control key: *cdata *here
Stmt: call ZENDSVR.iPLUG512K(?,?,?,?)
Input XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
<script>
<cmd>DSPLIBL OUTPUT(*PRINT)</cmd>
</script>
Output XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
<script>
<cmd><success><![CDATA[+++ success DSPLIBL OUTPUT(*PRINT)]]></success></cmd>
</script>
Exec end: 2013-01-30 10:03:32. Seconds to execute: 0.073724985122681.


Exec start: 2013-01-30 10:03:32
Version of toolkit front end: 1.4.0
IPC: ''. Control key: *cdata *here
Stmt: call ZENDSVR.iPLUG512K(?,?,?,?)
Input XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
<script>
<pgm name='QSPRILSP' lib='*LIBL'>
<parm io='out' comment='data'><data var='data' type='70A' /></parm>
<parm io='in' comment='len'><data var='len' type='10i0'>70</data></parm>
<parm io='in' comment='format'><data var='format' type='8A'>SPRL0100</data></parm>
<parm comment=''><ds var='errorDs'>
<data var='errbytes' type='10i0'>144</data><data var='err_bytes_avail' type='10i0'>144</data><data var='exceptId' type='7A'>0000000</data><data var='reserved' type='1A'> </data><data var='var0' type='0h' /></ds>
</parm>
</pgm>
</script>
Output XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
<script>
<pgm name='QSPRILSP' lib='*LIBL'>
<parm io='out' comment='data'>
<data var='data' type='70A' ><![CDATA[
Exec end: 2013-01-30 10:03:32. Seconds to execute: 0.049037933349609.
cbeck
 
Posts: 5
Joined: Fri Dec 04, 2009 5:33 pm

Re: QSPRILSP API Call fails

Postby aseiden on Fri Feb 15, 2013 9:00 am

The reason your output is chopped off: The SPRL0100 format includes binary data (32-bit integers) that cannot be brought back as part of a character string. The solution is to create a data structure representing this structure and include that as the receiver variable (first parameter). The subfields will be parsed for you.

SPRL0100 format is defined here:
http://publib.boulder.ibm.com/infocente ... PRILSP.htm

That said, if you're trying to retrieve output from DSPLIBL, there's an easier way:
Code: Select all
// skipping connection code...

// call command and bring back output using CLInteractiveCommand (good for "DSP*" commands)
$result = $conn->CLInteractiveCommand('DSPLIBL');

// output result of command, nicely formatted.
echo '<pre>Result: ';
var_dump($result);
echo '</pre>';

Please try and let me know.

--Alan Seiden

P.S. I like your technique to output the current portion of the debug log.
aseiden
 
Posts: 824
Joined: Thu Apr 09, 2009 5:45 pm

Re: QSPRILSP API Call fails

Postby cbeck on Fri Feb 15, 2013 3:08 pm

Thanks Alan that makes perfect sense.

As for the DSPLIBL that was purely for testing purposes.
cbeck
 
Posts: 5
Joined: Fri Dec 04, 2009 5:33 pm

Re: QSPRILSP API Call fails

Postby aseiden on Fri Feb 15, 2013 5:02 pm

Chris,

Excellent. If you don't mind: when your code is done, would you post the final code snippet, how you define the data structure and params for this API? It could be educational for future forum readers.

Thanks!
Alan
aseiden
 
Posts: 824
Joined: Thu Apr 09, 2009 5:45 pm


Return to New Toolkit

Who is online

Users browsing this forum: No registered users and 1 guest