Previous Topic: MQ GET—Retrieve Messages

Next 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)])
   {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 will be 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: Unlimited expiration time

Default: Unlimited

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)"