|  | 
 | ||||
|  | ||||||
| Related Topics | Other Library Functions | |||||
| function | mq-get | 
| Return type: String Returns: A string containing the retrieved message body. | 
define external stream function mq-get object value mq-object object message-descriptor value mq-message-descriptor MQMD get-options value mq-get-message-options MQGMO length value integer max-length
Argument definitions
Use mq-get to retrieve a message from an MQSeries queue.
You must include the following line at the beginning of your OmniMark program:
include "ommqi.xin"
The object must be open (else external exception OMMQI0013).
max-length must be greater than or equal to zero (else external exception OMMQI0014).
This function corresponds to the MQPUT function in the MQSeries API.
The object parameter maps to both the Hconn and Hobj parameters of MQPUT.
The returned stream corresponds to the Buffer parameter of MQPUT.
The CompCode and Reason parameters of MQPUT are integrated into the OMMQI error handling.
Connect to a queue and retrieve the first message.
  include "ommqi.xin"
  
  process
      local mq-connection       a-connection
      local mq-object               a-object
      local stream                 od-fields   variable
      local mq-object-descriptor   a-mqod
      local mq-message-descriptor  a-mqmd
      local mq-get-message-options a-mqgmo
      local stream                 message
  
      ; Connect to the MQSeries server using default values
      set a-connection to mq-connect
  
      ; Connect to the default queue on the server
      set new od-fields {"ObjectName"} to "default"
      mq-set-object-descriptor a-mqod to od-fields
      set a-object to mq-open connection           a-connection
                             object-descriptor a-mqod
                             options           MQOO_INPUT_AS_Q_DEF
  
      ; Get the first message in the queue, returning at most 1k of data
      set message to mq-get object              a-object
                            message-descriptor a-mqmd
                            get-options        a-mqgmo
                            length             1024
| Related Topics | Other Library Functions | 
Copyright © Stilo International plc, 1988-2010.