SYS_HOST_ALIVE
Script Function: It checks whether a particular Agent is active.
Syntax
SYS_HOST_ALIVE (Host[,Connection])
Syntax |
Description/Format |
---|---|
Host |
The name of the agent whose activity should be checked. |
Connection |
The name of an R3 or DB-type Connection object that should be used to verify the availability of the SAP system or the database. In SAP, you must enter the Connection object that you have defined in the Agent object's Agent tab. The parameter Host is optional when you specify a DB-type Connection object. Warning! To use this parameter, you must specify either an SAP or a database Agent in Host. The system will not check whether the database agent has started in order to resolve SQL variables. |
Return codes |
---|
A host has been specified: "Y" - The agent is active. A host plus a Connection object have been specified: "Y" - The agent is active and the SAP system or the database is available. |
OS Agents
The script function checks whether the agent is active. You cannot specify the parameter Connection.
ERP Agents
ERP agent PeopleSoft: The value "N" is supplied when the agent is active but the Enterprise Business Solution is not available.
SAP Agents: There are two options. You can only specify the parameter Host in order to check whether the SAP Agent is active To check whether the SAP system is available, you can additionally specify the corresponding SAP Connection object.
Warning! Note that the SAP Agent will open some connections only if they are required (HTTP) or terminate them automatically if they have not been used for a certain time (ABAP). A new connection will be established if there is no connection to the SAP system when you use SYS_HOST_ALIVE in order to check whether the SAP system is available. In this context, the following notes are important:
- The SAP system is not available: This could result in a long timeout duration.
- There is a connection to the SAP system but it is being used: You must establish a new connection in order to ensure that the SAP system is still available.
- Establishing an additional connection can result in an error if SAP's CPIC limit is exceeded, for example. In this case, SYS_HOST_ALIVE returns code "N" although jobs are already being processed via existing connections.
- Any changes in a Connection object require the SAP Agent to be restarted in order to become effective.
Database Agent
As in SAP, you can either specify only the agent, or a Connection object (type DB) in addition. If you specify a Connection object, you can also check the availability of the particular database.
Examples
The following example checks whether the Windows agent WIN21 is active. A message is sent to the administrator when it is inactive.
:IF SYS_HOST_ALIVE("WIN21") = "N"
: SEND_MSG
"ADMIN","AE","Agent WIN21 is not active!"
:ENDIF
The second example checks whether the SAP system is available for the agent SAP01.
:SET &STATUS# = SYS_HOST_ALIVE("SAP01", "CONN.R3.AWI.ABAP")
See also: