Automation Engine Script Guide > Ordered by Function > Activate Objects > SYS_ACTIVE_COUNT

SYS_ACTIVE_COUNT

Script Function: Returns the number of all activated objects

Syntax

SYS_ACTIVE_COUNT(Status, Object Type, [Object], [Group], [Host])

Syntax

Description/Format

Status

Status of all objects shown in the Activity Window
Format: AE name, script literal or script variable.

Allowed values: "*", "ANY_ABEND", "BLOCKED", "ANY_ALIVE", "PREPARED" and "RUNNING"

"*" = tasks of any statusThis represents the condition of a task (such as active, blocked, generating).
"ANY_ABEND" = canceled tasks
"ANY_ALIVE" = tasks of a groupAn Automation Engine object type that integrates tasks so that they can be processed together. that are neither canceled nor finished
"BLOCKED" = blocked tasks
"PREPARED" = for a group of registeredThis is the status of a task that runs within a group and is waiting for its start. tasks
"RUNNING" = active jobs

Object Type

Short form of the object typeAn individual object is provided for the individual activities: There are User, UserGroup, Notification, Cockpit, CodeTable, Documentation, Event, Agent, FileTransfer, Group, Include, Job, Workflow, Calendar, Login, Client, RemoteTaskManager, Schedule, Script, Server, Sync, Variable and TimeZone objects or "*" for all object types
Format: AE name, scriptA particular Automation Engine object type. literal or script variableA placeholder for a value within a script.

The parameters shown below are optional filter criteria. You can use one, two or all of them in any combination. Note that commas must always be set, even if particular parameters are not used.

Example:
:
SET &COUNT# = SYS_ACTIVE_COUNT("*", JOBS,,"MM.GROUP")

Object

Name of an objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task or filter for several objects
Format: AE name, script literal or script variable

Wildcard characters can be used. "*" stands for any character, "?" for exactly one.

Group

Name of a group or "*" for all groups
Format: AE name, script literal or script variable

Host

Name of an agentA program that enables the de-centralized execution of processes (such as deployments) on target systems (computers or business solutions) or a service that provides connectivity to a target system (such as for databases or middleware). An agent is also an object type in the Automation Engine. [Formerly called "Executor."] See also: host or filter for several agents
Format: AE name, script literal or script variable

Wildcard characters can be used. "*" stands for any character, "?" for exactly one.


Return code

Number of objects listed in the Activity Window

Comments

The functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,… SYS_ACTIVE_COUNT can be used to check the number of objects listed in the Activity Window. Use parameters to limit the search to particular tasks. Filters can be specified for status, object type, object name, group and hostComputer, target system.. Any combination is possible.

The parameter Host can also be used to handle the parallel execution of a jobAn Automation Engine object type for a process that runs on a target system. on a particular computer. Check whether or not a job is active using SYS_ACTIVE_COUNT if a job is processed on a regular basis. You can so avoid that executions overlap. The target host can be specified subsequently using the script statement :PUT_ATT. Source and target host can be specified if file transfers are concerned.

Using the parameter Host is only useful with objects of type "JOBS", "JOBF", "EVNT" or "*". Host filters exclude all other object types as they do not require agents for being processed. Hence, the sample script shown below always supplies "0":

:SET &COUNT# = SYS_ACTIVE_COUNT(ANY_ABEND,JOBP,,,"*")

Keep in mind that it is not checked whether or not the indicated host actually exists.

When filtering active jobs using the parameter "RUNNING", all jobs that have a system return codein the range of 1500 to 1599 are considered.

Examples

The following examples count the objects listed in the Activity Window. This includes the number of all blocked and canceled objects as well as the number of all events.

:SET &COUNT# = SYS_ACTIVE_COUNT("BLOCKED", "*")

:SET &COUNT# = SYS_ACTIVE_COUNT(ANY_ABEND, "*")

:SET &COUNT# = SYS_ACTIVE_COUNT("*", EVNT)

This example counts tasks that are registered for a specific group. The string "FILE" must appear in all taskAn executable object that is running. Tasks are also referred to as activities. names. 

:SET &COUNT# = SYS_ACTIVE_COUNT("PREPARED", "*", "*FILE*","GRP7")

The following example retrieves the number of jobs that use agent "UNIX01".

:SET &COUNT# = SYS_ACTIVE_COUNT("*", "JOBS", "*",,"UNIX01")

 

See also:

Script element Description

SYS_STATE_JOBS_IN_GROUP

Returns the number of jobs that are registered in groups

Script Elements - Activate Objects

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH