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

mq-put

 
 

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

Declaration

  define external function mq-put
    object                value            mq-object               object
    message-descriptor   value            mq-message-descriptor  MQMD
    put-options          value            mq-put-message-options MQPMO
    message              value            stream                 message

Argument definitions

object
is an IBM MQSeries mq-object representing a previously opened queue
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-put to place a message on one or more queues.

Requirements

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

  include "ommqi.xin"

The MQSeries queue represented by object must be open (else external exception OMMQI0013)

Usage Notes

This function corresponds with the IBM MQSeries function MQPUT. See the IBM MQSeries documentation for MQPUT for more information.

The queue parameter maps to both the Hconn and Hobj parameters of MQPUT.

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 a message on a single queue.

  process
    local mq-connection        a-connection
    local mq-object                a-object
    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 the default queue-manager
    set a-connection to mq-connect

    ; Set up the MQOD structure (putting to queue default)
    set new od-fields {"ObjectName"} to "default"
    mq-set-object-descriptor mqod to od-fields

    ; open the queue
    set a-object to mq-open connection          a-connection
                           object-descriptor mqod
                           options           MQOO_OUTPUT

    ; set up the MQPMO 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 MQMD structure
    set new md-fields {"Format"} to MQFMT_STRING
    mq-set-message-descriptor mqmd to md-fields

    ; put the message on the queue
    mq-put object              a-object
           message-descriptor mqmd
           put-options        mqpmo
           message            "A simple mqput message"

Example #2

Put a message on multiple queues using a distribution list

    local mq-queue-manager        a-manager
    local mq-queue                a-queue
    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-manager to mq-connect

    ; Open using the distribution list previously defined
    set a-queue to mq-open manager           a-manager
                           object-descriptor mqod
                           options           MQOO_OUTPUT

    ; Set up the MQPMO 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 MQMD Structure
    set new md-fields {"Format"} to MQFMT_STRING
    mq-set-message-descriptor mqmd to md-fields

    ; Put the message to both queues
    mq-put queue              a-queue
           message-descriptor mqmd
           put-options        mqpmo
           message            "A multi-queue message"

    Related Syntax
   mq-get
   mq-put1message
 
  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:32 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.