Previous Topic: MQ GET—Retrieve MessagesNext Topic: MQ SET—Set Attributes


MQ PUT—Put Messages on the Queue

The ADDRESS MQ PUT command puts the message on a message queue.

This command has the following format:

ADDRESS MQ PUT OPTIONS([STEM(varSTEM)] [CORRELID(NEW)] [EXPIRY(time units | UNLIMITED)] [FORMAT(NONE | STRING)] [PRIORITY(msgpriority)])
   {CONHANDLE(varHCONN)}
   {OBJHANDLE(varHOBJ)}
   {DATA(varDATA)}
OPTIONS

Specifies the processing options.

STEM(varSTEM)

(Optional) Creates the variable varSTEM.CORRELID that contains a value of CorrelID. The output displays in hex format.

CORRELID(NEW)

(Optional) Puts the message and receives new unique CORRELID, which is stored in varSTEM.CORRELID.

Specifying STEM automatically creates the variable varSTEM.CORRELID. If STEM is omitted, the default name MQ.CORRELID is used.

Note: The new CORRELID is prefixed with 'OPS/MVS'.

EXPIRY(time units | UNLIMITED)

(Optional) Specifies the expiration time of the message in minutes, hours, days, or weeks.

Possible values:

  • Time: 1 to 120
  • Units: Minutes, hours, days, or weeks
  • UNLIMITED: An unlimited expiration time

Default: Unlimited

FORMAT(NONE | STRING)

(Optional) Specifies a format name of message data.

Possible values:
  • NONE: Format of message data is undefined. Data cannot be converted using the CONVERT option.
  • STRING: Message of this format can be converted when the CONVERT option is specified.

Default: NONE

PRIORITY(msgpriority)

(Optional) Puts the message and set the message priority.

Possible values:
  • msgpriority: 0 - 9.

Default: A queue default message priority.

CONHANDLE(varHCONN)

Defines the variable name that stores the connection handle.

OBJHANDLE(varHOBJ)

Defines the variable name that stores the object handle.

DATA(varDATA)

Defines the variable name that stores the message.

Note: Input data automatically truncates to 32,000 bytes if data > 32000 bytes.

Examples: MQ PUT

This example puts the message on the queue, specifies an expiry time, and receives the Correl ID to MYSTEM.CORRELID:

ADDRESS MQ "PUT OPTIONS(EXPIRY(80 DAYS),STEM(myStem),CORRELID(NEW))",
           "CONHANDLE(hconn) OBJHANDLE(hobj) DATA(data2put)"

This example does not specify the STEM option, which receives the Correl ID to MQ.CORRELID:

ADDRESS MQ "PUT OPTIONS(EXPIRY(80 DAYS),CORRELID(NEW))",
           "CONHANDLE(hconn) OBJHANDLE(hobj) DATA(data2put)"