Home

 

Usage notes

  1. We can use this call only when the queue manager itself coordinates the unit of work. This can be:

    • A local unit of work, where the changes affect only MQ resources.

    • A global unit of work, where the changes can affect resources belonging to other resource managers, as well as affecting MQ resources.

    For further details about local and global units of work, see MQBEGIN - Begin unit of work.

  2. In environments where the queue manager does not coordinate the unit of work, use the appropriate back-out call instead of MQBACK. The environment might also support an implicit back out caused by the application terminating abnormally.

    • On z/OS, use the following calls:

      • Batch programs (including IMS batch DL/I programs) can use the MQBACK call if the unit of work affects only MQ resources. However, if the unit of work affects both MQ resources and resources belonging to other resource managers (for example, DB2), use the SRRBACK call provided by the z/OS Recoverable Resource Service (RRS). The SRRBACK call backs out changes to resources belonging to the resource managers that have been enabled for RRS coordination.

      • CICS applications must use the

        EXEC CICS SYNCPOINT ROLLBACK command to back out the unit of work. Do not use the MQBACK call for CICS applications.

      • IMS applications (other than batch DL/I programs) must use IMS calls such as

        ROLB to back out the unit of work. Do not use the MQBACK call for IMS applications (other than batch DL/I programs).

    • On i5/OS, use this call for local units of work coordinated by the queue manager. This means that a commitment definition must not exist at job level, that is, the

      STRCMTCTL command with the CMTSCOPE(*JOB) parameter must not have been issued for the job.

  3. If an application ends with uncommitted changes in a unit of work, the disposition of those changes depends on whether the application ends normally or abnormally. See the usage notes in MQDISC - Disconnect queue manager for further details.

  4. When an application puts or gets messages in groups or segments of logical messages, the queue manager retains information relating to the message group and logical message for the last successful MQPUT and MQGET calls. This information is associated with the queue handle, and includes such things as:

    • The values of the GroupId, MsgSeqNumber, Offset, and MsgFlags fields in MQMD.

    • Whether the message is part of a unit of work.

    • For the MQPUT call: whether the message is persistent or nonpersistent.

    The queue manager keeps three sets of group and segment information, one set for each of the following:

    • The last successful MQPUT call (this can be part of a unit of work).

    • The last successful MQGET call that removed a message from the queue (this can be part of a unit of work).

    • The last successful MQGET call that browsed a message on the queue (this cannot be part of a unit of work).

    If the application puts or gets the messages as part of a unit of work, and the application then decides to back out the unit of work, the group and segment information is restored to the value that it had previously:

    • The information associated with the MQPUT call is restored to the value that it had before the first successful MQPUT call for that queue handle in the current unit of work.

    • The information associated with the MQGET call is restored to the value that it had before the first successful MQGET call for that queue handle in the current unit of work.

    Queues that were updated by the application after the unit of work started, but outside the scope of the unit of work, do not have their group and segment information restored if the unit of work is backed out.

    Restoring the group and segment information to its previous value when a unit of work is backed out allows the application to spread a large message group or large logical message consisting of many segments across several units of work, and to restart at the correct point in the message group or logical message if one of the units of work fails. Using several units of work might be advantageous if the local queue manager has only limited queue storage. However, the application must maintain sufficient information to be able to restart putting or getting messages at the correct point in the event that a system failure occurs. For details of how to restart at the correct point after a system failure, see the MQPMO_LOGICAL_ORDER option described in MQPMO - Put-message options, and the MQGMO_LOGICAL_ORDER option described in MQGMO - Get-message options.

    The remaining usage notes apply only when the queue manager coordinates the units of work:

  5. A unit of work has the same scope as a connection handle. All MQ calls that affect a particular unit of work must be performed using the same connection handle. Calls issued using a different connection handle (for example, calls issued by another application) affect a different unit of work. See the Hconn parameter described in MQCONN - Connect queue manager for information about the scope of connection handles.

  6. Only messages that were put or retrieved as part of the current unit of work are affected by this call.

  7. A long-running application that issues MQGET, MQPUT, or MQPUT1 calls within a unit of work, but that never issues a commit or backout call, can fill queues with messages that are not available to other applications. To guard against this possibility, the administrator must set the MaxUncommittedMsgs queue-manager attribute to a value that is low enough to prevent runaway applications filling the queues, but high enough to allow the expected messaging applications to work correctly.



 

Home