We are trying to implement 'CICS Asynchronous Message Consumption' that works on the MQ Pub/Sub model.
A part of the backout mechanism involves the consumer program reading the messages but not being able to consume the message (because of any technical/program/database failure or may be even because of unexpected data). So when such a situation arrives, the consume module treats this message as a 'poison message' and performs a SYNCPOINT ROLLBACK and thus incrementing the MQMD-BACKOUTCOUNT from 0 to 1.
Now when this message is again read by the consumer module written in COBOL, it checks if MQMD-BACKOUTCOUNT > 0 but this validation fails, thus avoiding the poison processing and results in endless loops.
What surprises me is that though the SYSVIEW is capturing the backount count of the message in the queue (goes till 255), but the program fails to do so and the same is always = 0 in the program.
FYI, every time that poison message is consumed, the task remains same as we have displayed it in the logs.
Please suggest me what should I do. Is it acceptable for the COBOL program to change/initialize the mqmq-backoutcount field as it is something that should be update from WMQ.
************************************************************
C301-CHECK-ROLLBACK-MSG SECTION.
************************************************************
IF MQMD-BACKOUTCOUNT > 0
* INCLUDE THE LOGIC HERE TO PUSH THE MESSAGE (THAT HAS BEEN
* ROLLED BACK ONCE) TO THE BO QUEUE SAMPLE.CONTROL.QUEUE.BO
PERFORM C032-PROCESS-POISON-MESSAGE
ELSE
IF MQMD-BACKOUTCOUNT = 0
DISPLAY 'Rollback the message'
EXEC CICS SYNCPOINT
ROLLBACK
END-EXEC
DISPLAY 'AFTER EXEC CICS ROLLBACK'
END-IF
END-IF
.
C301-CHECK-ROLLBACK-MSG SECTION.
************************************************************
IF MQMD-BACKOUTCOUNT > 0
* INCLUDE THE LOGIC HERE TO PUSH THE MESSAGE (THAT HAS BEEN
* ROLLED BACK ONCE) TO THE BO QUEUE SAMPLE.CONTROL.QUEUE.BO
PERFORM C032-PROCESS-POISON-MESSAGE
ELSE
IF MQMD-BACKOUTCOUNT = 0
DISPLAY 'Rollback the message'
EXEC CICS SYNCPOINT
ROLLBACK
END-EXEC
DISPLAY 'AFTER EXEC CICS ROLLBACK'
END-IF
END-IF
.