swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

mq-commit

 
 

Library: Interfaces, MQSeries access (OMMQI)
Include: ommqi.xin

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 Syntax
   mq-backout
 
  Other Library Functions
   mq-backout
   mq-close
   mq-commit
   mq-connect
   mq-connection
   mq-connectx
   mq-disconnect
   mq-get
   mq-get-entire-return-status
   mq-get-function-status
   mq-get-logging-level
   mq-get-throw-on-warnings
   mq-inquire
   mq-inquire-names
   mq-object
   mq-open
   mq-put
   mq-put1message
   mq-set
   mq-set-logging-level
   mq-set-throw-on-warnings
 
 

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

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:31 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.