Page 1 of 1

Tough Interview Question need answer

PostPosted: Wed Nov 21, 2018 1:32 am
by poloman
You have a COBOL program that reads MQ queue and writes data to files; but program abends,
so how do you make sure that when you restart the program after fixing the abend the data is correct from the MQ.

Re: Tough Interview Question need answer

PostPosted: Wed Nov 21, 2018 2:44 pm
by Garry F Carroll
Not so tough.

First, to ensure that the MQ message survives across a possible restart of the MQ Queue Manager, the message should be persistent. This is set at the time the message is put to the queue. Non-persistent messages are lost on Queue Manager restart.

Next, your Cobol program that gets (not reads) the message must get the message in syncpoint (MQGMO-SYNCPOINT) so that, in the event of a failure, the message is reinstated on the queue. If the get is with MQGMO-NO-SYNCPOINT, the message cannot be reinstated. On successful processing of the message (or set of messages) a commit is to be issued.

Finally, to ensure that a bad message does not result in an infinite loop of retries, the program should check the message's backoutcount and take appropriate action if this exceeds a pre-determined threshold.

Garry.

Re: Tough Interview Question need answer

PostPosted: Thu Nov 29, 2018 2:58 am
by poloman
Thanks Gary - that helps a lot.