How you can automate the administration of an application using the MSGTAC program is illustrated using an example in which the message K041 Warning level xx for PAGEPOOL exceeded
triggers an automatic response. In place of K041 you can also insert other messages such as K091 Due to resource bottleneck ...
for control purposes.
For this example, the message destination MSGTAC must be defined for K041, and an MSGTAC program must be written which processes this message and issues an FPUT output message to start an asynchronous program PRGK041.
You will find two versions of PRGK041 illustrated below. In one example it carries out the administration operations through the program interface and in the other it uses the command interface. The functions may also be realized within the MSGTAC routine itself.
Structure of an MSGTAC program
The MSGTAC program can be set up along the following lines:
/***************************** MSGTAC program ****************************/ #include <kcmsg.h> INIT FGET message /* Read message */ ... switch (msg-id) { case Kxx:... case K041: { FPUT data KCRN=PRGK041 /* Call program unit PRGK041 */ break; ... case Kyy:.. } PEND FI
The program PRGK041 controls the operations necessitated by the occurrence of K041. The diagram below outlines what PRGK041 might look like if it uses the program interface and the command interface.
Control via the program interface
The following asynchronous administration program is started with MSGTAC.
/********** Program unit PRGK041 for KDCADMI program interface ***********/ #include <kcadminc.h> /* Head file for administration */ INIT FGET data /* Read data supplied by MSGTAC */ KDCADMI opcode=KC_GET_OBJECT /* Administration call: UTM returns the */ /* requested statistical data to the */ /* program. */ if {... } /* Analyze data and prepare operations */ KDCADMI opcode=KC_MODIFY_OBJECT /* The appropriate parameter is modified. */ /* Additional KDCADMI calls may be needed */ /* to modify other parameters. */ FPUT /* Message to administrator if necessary */ PEND FI
You can have the application data read and analyzed within a program; any number of KDCADMI calls is permitted. This means that a number of application parameters can be modified if this should be necessary as a result of the current application data.
Example: activating/deactivating automatic diagnostics
The following example is a response to the message
K119 OSI-TP error information...
An MSGTAC program such as the one outlined in section "Structure of an MSGTAC program" intercepts K119 and uses FPUT to start the administration program. Depending on the information supplied in K119, this program activates the OSI trace functions.
#include <kcadminc.h> /* Header file for administration */ ... INIT FGET /* Read data from MSGTAC */ if {... } /* Analyze data */ KDCADMI opcode=KC_MODIFY_OBJECT /* Activate OSI trace functions under */ /* certain circumstances. */ FPUT KCRN=admin-lterm /* Message to administrator: trace running */ DPUT KCRN=TRACEOFF /* After a while, a further asynchronous */ /* program (TRACEOFF) deactivates the */ /* trace again. */ PEND FI
You can also use this program structure, for example, to respond to the message K065 Net message ..
. You can follow the same pattern to write a program which creates a UTM dump in response to a message with KDCADMI opcode=KC_CREATE_DUMP.