I am having issues rendering a spoolfile onto a web page. We are on V6R1, with (I think) the latest zend framework.
This works ... in that It correctly prints an array with the desired spoolfiles in it.
Code: Select all
$opts = array("i5_naming"=>DB2_I5_NAMING_ON, "i5_commit"=>DB2_I5_TXN_NO_COMMIT);
$SplfConn = db2_connect($i5_srvr, $user, $pass, $opts);
if (!$SplfConn) die('Could not connect to db: ' . db2_conn_error() . ' ' . db2_conn_errormsg());
try {
$ToolkitServiceObj = ToolkitService::getInstance($SplfConn, '1');
}
catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
$ToolkitServiceObj->setToolkitServiceParams(array('plug'=>"iPLUG1M"));
$SpoolFiles = new SpooledFiles($ToolkitServiceObj);
try {
$spool_list = $SpoolFiles->GetSPLList($SplfUserName);
}
catch (Exception $e) {
echo $e->getMessage(), "\n";
exit();
}
if( is_array($spool_list) && count($spool_list)> 0) {
print_r($spool_list);
}
Code: Select all
// real values obscured of course ...
$sname = 'MySplfName';
$snmbr = 'splf#';
$jname = 'jobname';
$jnmbr = 'jobnmbr';
$juser = 'jobuser';
$splfsize = sizeof($spool_list);
for ($x=0; $x<$splfsize; $x++) {
$nextsplf = $spool_list[$x];
$s0 = $nextsplf['Number'];
$s1 = $nextsplf['Name'];
$s2 = $nextsplf['JobNumber'];
$s3 = $nextsplf['JobName'];
$s4 = $nextsplf['JobUser'];
echo "s0=[$s0] s1=[$s1] s2=[$s2] s3=[$s3] s4=[$s4] <br />";
if( (trim($s0) == trim($snmbr)) && (trim($s1) == trim($sname)) &&
(trim($s2) == trim($jnmbr)) && (trim($s3) == trim($jname)) &&
(trim($s4) == trim($juser)) ) {
echo "found it<br />";
/*
This is the command from the iToolkitService.php module, when i do an echo "cmd=[$cmd]"; it shows the CORRECT details in the command
$cmd = sprintf ("CPYSPLF FILE(%s) TOFILE($this->TmpLib/$this->TMPFName) JOB(%s/%s/%s) SPLNBR(%s)",
$SplfName , trim($JobNmbr), trim($JobUser), trim($JobName), $SplfNbr);
*/
$txt = $SpoolFiles->GetSPLF($s1, $s0, $s2, $s3, $s4, "SPLFTEST");
print_r($txt);
}
}
As noted above when I echo out the $cmd string from the toolkit it correctly shows the CPYSPLF command that I am looking for, and when I copy and paste that onto the command line it works - so I know the format is good.
However - when I check the QGPL/SPLFTEXT file - it is always empty?
And it throws an exception error message ...
[b]Fatal error: [/b] [color=#BF0000]Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in /usr/local/zendsvr6/var/libraries/PHP_Toolkit_for_IBMI_i/1.5.0/library/ToolkitService.php on line 1624[/color]
I think the error is due to the file being empty (0 rcds)
but WHY is the [b]CPYSPLF [/b]statement from function GetSPLF not working?
Cheers
GC