swirl
Guide to OmniMark 9   OmniMark home
docs home 
 
  Related Topics   Other Library Functions  
function  

mq-commit

 
 


Declaration

define external function mq-commit
  connection              value       mq-connection connection

Argument definitions

connection
is a connected mq-connection object.


Purpose

Use mq-commit to commit an active IBM MQSeries unit of work.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "ommqi.xin"

The connection object must be connected (else external exception OMMQI0011).

Usage Notes

This function corresponds to the MQCMIT function in the MQSeries API.

The CompCode and Reason parameters of MQCMIT are integrated into the OMMQI error handling.

Example

Commit two messages added to a queue as part of a transaction, so that they appear simultaneously.

     local mq-connection       a-connection
     local mq-object               a-object
     local stream                 od-fields   variable
     local mq-object-descriptor   a-mqod
     local stream                 md-fields   variable
     local mq-message-descriptor  a-mqmd
     local stream                 pmo-fields  variable
     local mq-put-message-options a-mqpmo
  
     ; Connect to queue manger
     set a-connection to mq-connect
  
     set new od-fields {"ObjectName"} to "default"
     mq-set-object-descriptor a-mqod to od-fields
  
     ; Open queue
     set a-object to mq-open connection a-connection
           object-descriptor a-mqod
           options MQOO_OUTPUT
  
     ; Initialize structure for putting message. Specify we want to start
     ; a unit of work
     set new pmo-fields {"Options"} to
            "d" % (MQPMO_NEW_MSG_ID union
                   MQPMO_NEW_CORREL_ID union MQPMO_SYNCPOINT)
     mq-set-put-message-options a-mqpmo to pmo-fields
  
     set new md-fields {"Format"} to MQFMT_STRING
     mq-set-message-descriptor a-mqmd to md-fields
  
     ; Put message 1 in the queue
     mq-put object a-object
              message-descriptor a-mqmd
              put-options a-mqpmo
              message "This is a test message."
  
     ; Put message 2 in the queue
     mq-put object a-object
              message-descriptor a-mqmd
              put-options a-mqpmo
              message "This is another test message."
  
     ; Commit the messages so they can be gotten
     mq-commit connection a-connection

    Related Topics
 
Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.