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

mq-put1message

 
 


Declaration

define function mq-put1message
  connection             value            mq-connection       connection
  object-descriptor    value            mq-object-descriptor   MQOD
  message-descriptor   value            mq-message-descriptor  MQMD
  put-options          value            mq-put-message-options MQPMO
  message              value            stream                 message

Argument definitions

connection
is an IBM MQSeries queue manager connection.
MQOD
is a configured mq-object-descriptor object.
MQMD
is a configured mq-message-descriptor object.
MQPMO
is a configured mq-put-message-options object.
message
is the text representation of the data that will be put on the queue or queues represented in the opened queue object.


Purpose

Use mq-put1message to open a queue object or distribution list, send a message and close the queue object.

Requirements

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

  include "ommqi.xin"

The manager represented by connection must be connected (else external exception OMMQI0011)

Usage Notes

This function corresponds function MQPUT1 in the MQSeries API . See the IBM MQSeries documentation for MQPUT1 for more information.

The BufferLength parameter in the IBM MQSeries C interface is not included in the OmniMark MQSeries interface as it is calculated from the message parameter.

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

Setting of MQPMR structures inside the the MQPMO (mq-put-message-options) structure is not supported in this version of the OmniMark MQSeries interface.

Example #1

Put one message on a single queue.

  process
    local mq-connection       a-connection
    local stream                 od-fields   variable
    local mq-object-descriptor   MQOD
    local stream                 md-fields   variable
    local mq-message-descriptor  MQMD
    local stream                 pmo-fields  variable
    local mq-put-message-options MQPMO
  
    ; Connect to queue-manager
    set a-connection to mq-connect
  
    ; Set up the object-descriptor structure
    set new od-fields {"ObjectName"} to "default"
    mq-set-object-descriptor MQOD to od-fields
  
    ; Set up the put-message-options structure
    set new pmo-fields {"Options"} to
             "d" % (MQPMO_NEW_MSG_ID union MQPMO_NEW_CORREL_ID)
    mq-set-put-message-options MQPMO to pmo-fields
  
    ; Set up the message-descriptor structure
    set new md-fields {"Format"} to MQFMT_STRING
    mq-set-message-descriptor MQMD to md-fields
  
    ; Put 1 message on a queue
    mq-put1message connection           a-connection
                   object-descriptor  MQOD
                   message-descriptor MQMD
                   put-options        MQPMO
                   message            "A test message for mq-put1message"

Example #2

Put a message on multiple queues using a distribution list

    local mq-connection       a-connection
    local mq-object-descriptor   MQOD
    local stream                 od-fields variable
    local stream                 or-shelf variable
    local mq-object-record       object-records variable
    local mq-response-record     error-records variable
    local stream                 md-fields   variable
    local mq-message-descriptor  MQMD
    local stream                 pmo-fields  variable
    local mq-put-message-options MQPMO
  
    ; Need version 2 MQOD for distribution lists
    set new od-fields {"Version"} to "2"
    mq-set-object-descriptor MQOD to od-fields
  
    ; Add a object-record to the or-shelf
    set new or-shelf {"ObjectName"} to "default"
    new object-records
    mq-set-object-record object-records to or-shelf
  
    ; Add another object-record to the objects-records shelf
    set or-shelf {"ObjectName"} to "postcard"
    new object-records
    mq-set-object-record object-records to or-shelf
  
    ; insert the object-records shelf into the MQOD
    mq-set-mqor-of-mqod object-records of MQOD
  
    ; connect to default queue-manager
    set a-connection to mq-connect
  
    ; Set up the put-message-options structure
    set new pmo-fields {"Options"} to
             "d" % (MQPMO_NEW_MSG_ID union MQPMO_NEW_CORREL_ID)
    mq-set-put-message-options MQPMO to pmo-fields
  
    ; Set up the message-descriptor structure
    set new md-fields {"Format"} to MQFMT_STRING
    mq-set-message-descriptor MQMD to md-fields
  
    mq-put1message connection            a-connection
                   object-descriptor  MQOD
                   message-descriptor MQMD
                   put-options        MQPMO
                   message            "mq-put1 multi-queue test message"

    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.