SYS_ACTIVE_COUNT

Use the SYS_ACTIVE_COUNT script function to return the number of all activated tasks that are currently listed in the Process Monitoring perspective. The script function lets you limit the search to particular tasks by specifying the status, object type, object name, group and host, or a combination of these filters.

Tip: Use the Host parameter to check whether a regularly processed Job is active, to help you avoid overlapping executions. You can subsequently use :PUT_ATT to specify the target host, or the source and target host for File Transfer jobs.

Syntax

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

Parameters

  • SYS_ACTIVE_COUNT
    Returns the number of activated tasks shown in the Process Monitoring perspective

  • Status
    Filters by particular task status
    For more information, see Task Status .
    Format: AE name, script literal or script variable
    Allowed values:

    • ANY_ABEND
      Canceled tasks
    • ANY_ALIVE
      Tasks of a group that are neither canceled nor finished
    • BLOCKED
      Blocked tasks
    • PREPARED
      Tasks registered in a Job Group
    • RUNNING
      Active jobs
      Note: All jobs that have a system return code in the range of 1500 to 1599 are considered. For more information, see System Return Codes of Executable Objects.
    • *
      Any status

  • Object Type
    Short name of the object type
    Format: AE name, script literal or script variable
    Note: Use * to include all object types.

  • Object
    (Optional) Name of an object, or several objects
    Format: AE name, script literal or script variable
    Note: Use the wildcard character * to stand for any number of characters, or ? for a single character.

  • Group
    (Optional) Name of a Job Group
    Format: AE name, script literal or script variable
    Note: Use * to include all Job Groups.

  • Host
    (Optional) Name of an Agent, or several Agents
    Format: AE name, script literal or script variable
    Notes:

    • Use the wildcard character * to stand for any number of characters, or ? for a single character.
    • If you specify an Agent, the filter excludes all object types that do not require an Agent. The Host parameter is only useful with Job, File Transfer, and Event objects, or when you are including all object types.
      Example: The following script always returns 0.
      :SET &COUNT# = SYS_ACTIVE_COUNT(ANY_ABEND,JOBP,,,"*")
    Important! The system does not check whether the specified Agent actually exists.

Notes:

  • You can use one, two, or all of the optional parameters, and any combination.
  • Set all commas when you use the optional parameters, even if you omit particular parameters.
    Example: :SET &COUNT# = SYS_ACTIVE_COUNT("*", JOBS,,"MM.GROUP")

Examples

The following examples return the number of activated objects listed in the Process Monitoring perspective, with different parameters to include only particular tasks.

  • Number of all blocked tasks:
    :SET &COUNT# = SYS_ACTIVE_COUNT("BLOCKED", "*")

  • Number of all canceled tasks:
    :SET &COUNT# = SYS_ACTIVE_COUNT(ANY_ABEND, "*")

  • Number of Events:
    :SET &COUNT# = SYS_ACTIVE_COUNT("*", EVNT)

The following 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 an Agent that is called UNIX01.

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

See also: