Work with Job Methods

Work with Job methods allows you to work with information related to a user job.                                 

JobList

JobList ($User, $Jobstatus) - returns all user jobs information.

          

Arguments

Value

Description

$User

 

User name

$Jobstatus

*ACTIVE - default

Job status

Sample Code

Usage Example

$JobListArray = $Jobs->createJobListArray($Jobs->JobList("*CURRENT  ", "*ACTIVE   ")}

 

createJobListArray                                                           

createJobListArray($JobListString) - Creates an array for all the user’s jobs information.    

 

Arguments

Value

Description

$JobListString

 

Return string from JOBLIST() method

Sample Code

Usage Example

$JobListArray = $Jobs->createJobListArray($Jobs->JobList("*CURRENT  ", "*ACTIVE   "));

 

JobLog

JobLog($JobName, $JobUser, $JobNumber, $Direction = 'L') - Returns the job’s log messages.      

Arguments

Value

Description

$JobName

 

Job name; ‘*’ -  Returns current job log messages     

$JobUser

 

Job user

$JobNumber

 

Job number

$Direction

L - default

The log messages order. The ‘L’ indicates descending order (from the last message to the first)

Sample Code

Usage Example

o $JobLogMsgs = $Jobs->JobLog('*', ' ', ' ', ' ');

 

A PHP Script That Shows The Usage of Work with Job Methods

Usage Example

<?php
include_once '../API/iToolkitService.php';
try {
         $ToolkitSrvObj = ToolkitService::getInstance("*LOCAL", "",  "");
     }
         catch (Exception $e) {              
        echo  $e->getMessage(), "\n";
        exit();
}
  
$Jobs = new JobLogs($ToolkitSrvObj);
PrepareJobListArray($Jobs);
$ToolkitSrvObj->disconnect();
function PrepareJobListArray($Jobs)
{
     
    echo "<pre>";
    echo "Shows Active jobs for the *CURRENT user :<BR>";  
    try{
    $JobListArray = $Jobs->createJobListArray($Jobs->JobList("*CURRENT  ", "*ACTIVE  
"));
    }
    catch (Exception $e) {              
        echo  $e->getMessage(), "\n";
        exit();
    }
    foreach($JobListArray as $job){             
        $jobstring = sprintf("%10.10s %10.10s %10.10s %10.10s <BR>",
                           $job['JOBNAME'],
                           $job['JOBNUMBER'],  
                           $job['JOBSUBS'],
                          trim($job['ACTJOBSTATUS']) );                 
         
              echo $jobstring;
        }
      
   echo "</pre>";
   return;
}
  
   
?>