TCP CICS transactions integration and automated rollback
Introduction
Integrating BizTalk applications with Mainframe programs can be done using many methods. One of the most convenient methods is to use the TCP CICS integration model using the standard listener TRM or enhanced listener ELM program link. Both these methods requires installation of a concurrent server (listener) on the Mainframe to handle TCP and sockets communication. Host Integration Server comes packed with an example concurrent server. One problem that you might face when using this model is the case of a processing of a transaction on the Mainframe and while this processing is happening on the Mainframe the socket communication fails. In this case you will face a condition where the transaction is already done on the Mainframe but the application on BizTalk is not aware that the transaction is performed so if there is no mechanism against this then the same transaction can be executed twice.
Discussion & Resolution
A resolution of this problem is to edit the concurrent server program on the Mainframe to issue a CICS ABEND in the case of a socket failure. This insures that if the response is not delivered to the application then the transaction would be rolled back on the Mainframe, this though requires that all Mainframe programs to be used should not implement any SYNCPOINT.
To change the HIS provided sample for the concurrent listener to implement this approach the following should be added to the program MSCOMTI.cbl in the “STANDARD-LISTENER” procedure and after processing the “WRITE-BUF-TO-SOCKET” procedure.
PERFORM WRITE-BUF-TO-SOCKET THRU
WRITE-BUF-TO-SOCKET-EXIT
IF CHILD-SERVER-ERROR < 0 THEN
MOVE SS-CLOSE-SOCKET TO NEXT-STATE
MOVE 'Y' TO ABEND-STAT
ELSE
Then within the same procedure after the loop ends add the following code to issue the ABEND.
IF ABEND-IS-REQUIRED THEN
MOVE TP-ABEND-1 TO TRACE-ID
PERFORM TRACE-POINTS THRU TRACE-POINTS-EXIT
EXEC CICS ABEND ABCODE('ABC') END-EXEC
END-IF.
This will make sure that the transaction on the Mainframe will rollback if no response can be delivered to the application due to any connectivity problems.
Full source of the customized listener is here.