SYS_HOST_ALIVE

Use the SYS_HOST_ALIVE script function to check whether a particular agent is active. The script function distinguishes OS agents, ERP agents, and Database agents and handles its parameters depending on which agent you define.

Syntax

SYS_HOST_ALIVE (Host[,Connection])

Parameters

  • SYS_HOST_ALIVE
    Checks whether a particular agent is active
  • Host
    The name of the agent whose activity you want to check
    Format:AE name or script variable
  • Connection
    (Optional) The name of an R3- or DB-type Connection object you want to use to verify the availability of the SAP system or the database. To use this parameter, you must specify an SAP or Database agent in Host. The system does not check whether the database agent which resolves the SQL variables has started. For SAP, you must enter the Connection object defined in the Agent page of the Agent object. The Host parameter is optional if you specify a DB-type Connection object.
    Format:AE name or script variable

Return codes

If a host is specified:

  • Y
    The agent is active.
  • N
    The agent is inactive.

If a host and a Connection object are specified:

  • Y
    The agent is active, and the SAP system or the database is available.
  • N
    The agent is active but cannot connect to the SAP system or database.
  • ?
    The agent is not active. So the system cannot identify whether or not the SAP system or the database is available.


Note: N is also returned if an Agent is not assigned to the Client running the script because the Agent is not available for that Client. For more information, see Assigning Clients to Agents.

OS Agents

The SYS_HOST_ALIVE script function checks whether the agent is active. You cannot use the Connection parameter.

Example

The following example checks whether the Windows agent WIN21 is active. A message is sent to the administrator if it is inactive.

:IF SYS_HOST_ALIVE("WIN21") = "N"
:   
SEND_MSG "ADMIN","AE","Agent WIN21 is not active!"
:
ENDIF

ERP Agents

PeopleSoft agents

If the agent is active but the Enterprise Business Solution is unavailable, the return code is "N".

SAP agents

There are two options. You can specify the Host parameter to check whether the SAP agent is active. Alternatively, you can additionally define the corresponding SAP Connection object to check whether the SAP system is available.

Important! The SAP Agent opens some connections only if required (HTTP) and terminates them automatically if they have not been used for a while (ABAP). A new connection is established if there is no connection to the SAP system when you use SYS_HOST_ALIVE to check whether the SAP system is available. In this context, keep the following in mind:

  • If the SAP system is unavailable, you should expect a long timeout duration.
  • If there is a connection to the SAP system, but this connection is already busy, you must establish a new connection to ensure that the SAP system can react.
  • Establishing an additional connection may result in an error if the CPIC limit of SAP is exceeded, for example. In this case, SYS_HOST_ALIVE returns "N" although jobs are already processed through existing connections.
  • If you change a Connection object, you must restart the SAP agent to apply the changes.

Example

The following example checks whether the SAP system is available for the agent SAP01.

:SET &STATUS# = SYS_HOST_ALIVE("SAP01", "CONN.R3.AWI.ABAP")

Database Agent

As in SAP, you can specify the agent or, additionally, a Database-type Connection object. If you define a Connection object, you can also check the availability of the particular database.

See also:

seealso

Script Elements for Handling Tasks