Writing monitoring programs

You must write a monitoring program to handle unexpected events that are reported by FEPI and errors returned by system programming commands.

FEPI reports these events by writing a record to a transient data (TD) queue. You can define pool-specific TD queues for FEPI, where information about events that relate to specific pools is reported. (There is also a common FEPI TD queue, CSZX, where events that do not relate to specific pools are reported.) Note that, if a pool-specific event occurs, and you have not defined a corresponding queue, information about the event is lost. Also, FEPI TD queues must be defined as NONRECOVERABLE; if a queue is ‘recoverable’, FEPI does not write to it, and discards any information about unexpected events.

Typically, you would arrange for the monitoring program to be triggered whenever an item is placed in a TD queue. (Define the queue with a trigger level of 1.) A single monitoring program can service several queues, by using EXEC CICS ASSIGN QNAME to check which queue triggered it. According to the nature of the event, the monitoring program might write a message, log the event, or embark on a full conversation.

For example, using this method, whenever a session is lost, the monitoring program is invoked. The TD queue data provides information about what happened. Your monitoring program can obtain this in the usual way with EXEC CICS READQ TD. The following copy books describe the structure of the data:
  • DFHSZAPA for Assembler language
  • DFHSZAPO for COBOL
  • DFHSZAPP for PL/I
  • DFHSZAPC for C.
Your program may then choose to reestablish the lost session, to reinitialize, and so on. It may also set indicators for the application programs if contact with a target has been lost altogether.

Monitoring programs are written using the techniques and commands discussed in Developing with the FEPI API. See also the overview of the sample monitoring program in FEPI sample program: Monitor and unsolicited data-handler.