API Reference Guide > PHP XMLSERVICE Toolkit > iToolkit Service Class > Spooled Files Methods

Spooled Files Methods

GetSPLList

GetSPLList ($UserName) - Retrieves a list of Spooled files for a user.  

 

Arguments

Value

Description

$UserName

*CURRENT – default

IBM i username

Sample Code

Usage Example

$spool_list = $SpoolFiles($UserName=”MIKE”)

 

The return value contains an array with the following elements:

GetSPLF

GetSPLF ($SplfName , $SplfNbr, $JobNmbr, $JobName, $JobUser, $TMPFName) - Retrieves a Spooled file’s content.

 

Arguments

Value

Description

$SplName

 

Spool file name

$SplNbr

 

Spool file number

$JobName

 

Job name

$JobUser

 

Job user

$TMPFName

“ “ - default

File name to store the Spooled file content

Sample Code

Usage Example

$txt = $SpoolFiles->GetSPLF($spool_list[0]['Name'],
                             $spool_list[0]['Number'],
                             $spool_list[0]['JobNumber'],
                             $spool_list[0]['JobName'],
                             $spool_list[0]['JobUser'],
                             "SPLFTEST");

 

 A PHP Script That Shows the Usage of all Spooled File Methods

Usage Example

<pre>
<?php
/* This program retrieves spooled file list from the current job (ZENDSVR/QTMHHTTP) and displays the content of the first spooled file entry. */

include_once 'authorization.php';
include_once '../API/iToolkitService.php';
try {
         $ToolkitServiceObj = ToolkitService::getInstance($db, $user, $pass);
     }
         catch (Exception $e) {              
         echo  $e->getMessage(), "\n";
        exit();
}

$ToolkitServiceObj->setToolkitServiceParams(array('plug'=>"iPLUG1M"));             
$SpoolFiles = new SpooledFiles($ToolkitServiceObj);
try {
    $spool_list = $SpoolFiles->GetSPLList();     
}
catch (Exception $e) {              
        echo  $e->getMessage(), "\n";
        exit();

}

if( is_array($spool_list) &&     count($spool_list)> 0) {         
/*array of spool files created */
/*output spool file parameters of the first element in spool file list array*/                 
        var_dump($spool_list[0]);
}         

if(strstr ($SpoolFiles->getError(), "No spooled files found for"))
{
    echo "Spool file list can not be retrived. Err:".$SpoolFiles->getError();
}
else
{     

        $txt = $SpoolFiles->GetSPLF($spool_list[0]['Name'],
                             $spool_list[0]['Number'],
                             $spool_list[0]['JobNumber'],
                             $spool_list[0]['JobName'],
                             $spool_list[0]['JobUser'],
                             "SPLFTEST");
    //output spool file data  from the first spool file         
        var_dump($txt);              


}     
/* Do not use the disconnect() function for "state full" connection */     
$ToolkitServiceObj->disconnect();
?>
<pre>

 

 

Read Also

  PHP XMLSERVICE Toolkit    
  iToolkit Service Class