× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You could test by:

1 - redirect the catsplf and stderr to files on the ifs to see if that is working or not (not tested from PHP).
> catsplf -j 761118/SCOTT/WOR040 wor040 1 > /tmp/cat.txt 2> /tmp/err.txt
$
> cat /tmp/err.txt
catsplf: 001-2372 Spool file wor040, number 1 for job 761118/SCOTT/WOR040 was
not found.
if it works /tmp/cat.txt will contain the spoolfile.

2 - If it does create the file on the IFS then you can get the spoolfile in 2 steps by putting it to a file on the ifs and then read (readfile) the file from PHP (possible work around until you can discover/fix the issue).

Scott


On 6/4/2013 1:54 PM, Jim Oberholtzer wrote:
Folks: In the following code (PHP), we are attempting to pull in a
spool file into the variable $result so we can format it and put it up
on a web page. If we run the command via the PHP code we get a null in
$result. If we run the command ( signed on as the same user ) from the
command line it works.

QSH CMD('catsplf -j 026555/KATTANASIO/H512D QPJOBLOG 2')

I checked to see if the user profile had *SPLCTL and it does.

Any Idea what might be going on?


function i5_spool_get_data($spoolName, $jobName, $userName, $jobNumber,
$spoolNumber, $fileName = '', $connection = null)
{
if (!$connection = verifyConnection($connection)) {
return false;
}

if (!is_numeric($spoolNumber)) {
// could be *NEXT or other misguided parameter. Use a '1' for
compatibility.
$connection->logThis("Spool file number value '$spoolNumber' is
unsupported. Please supply a number. The value '1' will be used.");
$spoolNumber = 1;
}

$cmdString = "catsplf -j {$jobNumber}/{$userName}/{$jobName}
{$spoolName} {$spoolNumber}";
**********************
call making the trouble below!
************************
//full command will look like "QSH CMD('catsplf -j
{$jobNumber}/{$userName}/{$jobName} {$spoolName} {$spoolNumber}')";
$result = $connection->qshellCommand($cmdString);

// if no error, we expect an array.
if (is_array($result)) {
// consolidate into a string with 0D0A separators
$resultString = trim(implode("\r\n", $result));

// if fileName provided, try to write data to the IFS file
(return true if successful or false).
// otherwise simply return the string.
if ($fileName) {

$bytesWritten = file_put_contents($fileName, $resultString);
if ($bytesWritten) {
// good! Wrote OK
return true;
} else {
// bad! Could not write file. Old toolkit used CPF9898
so let's also use it.
i5CpfError('CPF9898', "Could not write to file
'$fileName'.");
return false;
} //(if bytesWritten)


} else {
// no IFS filename provided. Return string to caller.
return $resultString;
} //(if $fileName)

} else {
// not an array. Probably a "false."
// Report the error.
$errMsg = $connection->getErrorMsg();
if (empty($errMsg)) {
$errMsg = 'Could not read spooled file. Check user
permissions or see error code for details.';
}
i5CpfError($connection->getErrorCode(), $errMsg);
return false;
} //(if is_array)


} //(i5_spool_get_data)



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.