End-session handler

This program cleans up sessions after use by FEPI sample application programs.

This transaction is started by FEPI when an application ends a conversation or when a session is released.

The conversation passed by FEPI must be accessed so that FEPI knows that the event is being handled. The processing required depends entirely on local requirements. For illustration purposes, this program keeps the session for use by another conversation or lets it end, depending on the event type.

The CONVID picked up from the START data and passed on the FEPI ALLOCATE PASSCONVID is not the same as the CONVID for the conversation that has been freed. Nevertheless, the end-session handler can use it to access the same FEPI terminal.

For end of conversation (EVENTTYPE=FREE in start data), processing could typically involve setting the session back to a known state (such as a clear back-end screen ready to accept a new transaction name), or handling security, or overriding the type of FREE used. Such processing would depend on the data mode and type that the session uses (which is obtained from the start data), whether the back-end system is CICS or IMS, and the type of FREE used (also obtained from the start data).

For end of session (EVENTTYPE=FREE and EVENTVALUE=RELEASE in start data), processing could typically involve handling security.

For both cases, there could be an indication (in EVENTVALUE in the start data) that CICS is shutting down, which might require alternative special processing. This transaction would have to be in the XLT to allow it to be started during shutdown.

After the processing, a report is written to a TS queue named SESSION, which can be browsed using CEBR. The format of the TS queue records is:
date time CZUU End-session handling completed
          RESP........0            RESP2.......0
          Target......TGTNAME      Node........NODENAME
          Pool........POOLNAME

Program logic

  Main procedure:
    RETRIEVE start data
    Access conversation using FEPI ALLOCATE with PASSCONVID
    Call PROCESS-RELEASE or PROCESS-FREE as appropriate
    Write event details to TS queue
    RETURN
  PROCESS-RELEASE routine:
    Handle as required
    Free conversation, ending session
  PROCESS-FREE routine:
    Handle as required
    Free conversation, keeping session