AMT Help Files

JobAlive Interface

The JobAlive object (IJobAlive) is returned by the CreateJobAlive function that is provided through the AMT-COBOL ComScript connection interface. Through this object, the functionality of the JobAlive utility can be used in programs that are written in any COM supporting development environment.

The following functionality is provided:

Properties


Name  Return type  Access Description 
AppName  String  Read/Write  The check for alive jobs will be performed for jobs of the application this property is set to. 
ErrorCode Integer Readonly The error code of the JobAlive object. Zero when there is no error.
ErrorDescription String Readonly The description of the error. Will be Ok when there was no error.
JobsAlive  Boolean  Readonly  When there are alive jobs that are not in the exclusion list this property is set to True. 
ReportsOnly  Boolean  Read/Write  When set to True the check for alive jobs will only be performed on reports. I.e. scripts and batches will be ignored. 

Functions



function name Return type  Parameters Description
Name Type 
Add Void  JobName  String Add the given job to the exclusion list. This job will then be ignored in the check for alive jobs.
Clear  Void  ---   Clears the exclusion list. 
Initialize  Void  ---   Initializes the JobAlive object. I.e. it clears the errorcode and description, clears the exclusion list and sets the property ReportsOnly to True. 

Example


PowerShell


#See ComScript Connection Interface
... 
$ComScr.Connect()

#Create an Object of the JobAlive Interface to be able to detect alive jobs

$JobsAlive = $ComScr.CreateJobAlive()


$JobsAlive
.Initialize()

$JobsAlive.ReportsOnly = $false


if
 ( -not ($JobsAlive.JobsAlive)) {

    Write-Host "There are no jobs alive"

} else {

    Write-Host "There are jobs alive"
}


if
 ($JobsAlive.ErrorCode -ne 0) {

    [void]$Msg.AddMsgInformation("ErrorCode is: $($JobAlive.ErrorCode)")

    [void]$Msg.AddMsgInformation("ErrorDescription is: $($JobAlive.ErrorDescription)")


# Finally release the variables and clean up the session.
$ComScr.Dispose()