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 status
"ANY_ABEND" = canceled tasks
"ANY_ALIVE" = tasks of a group that are neither canceled nor finished
"BLOCKED" = blocked tasks
"PREPARED" = for a group of registered tasks
"RUNNING" = active jobs

Object Type

Short form of the object type or "*" for all object types
Format: AE name, script literal or script variable

Object

Name of an object 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.

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")

Group

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

Host

Name of an agent 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 function 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 host. Any combination is possible.

The parameter Host can also be used to handle the parallel execution of a job 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 code in 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 task 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