MQMD

Manipulates message descriptor parameters to be used on a subsequent MQPUT, MQPUT1, or MQGET call.

Syntax

CALL MQMD(hmd, action, rc ,parms ,value1, value2, ...>);

Required Arguments

hmd
Numeric, input or output
On input, specifies a Base SAS internal message descriptor handle. The handle should be supplied when you are setting or querying a value. The handle is generated as output when action is to generate default "message descriptor" parameters.
action
Character, input
Specifies the desired action of this routine. The following action values are valid:
GEN
Generate a handle that represents default message descriptor parameters as defined by WebSphere MQ.
SET
After a message descriptor handle has been generated, you can continue to set values as necessary.
INQ
After a message descriptor handle has been generated, you can query its values.
rc
Numeric, output
Provides the Base SAS return code from this function. If an error occurs, then the return code is nonzero. You can use the Base SAS function SYSMSG() to obtain a textual description of the return code.
parms
Character, input
Specifies an optional string of message descriptor parameters that you want to set for subsequent MQPUT, MQPUT1, or MQGET calls. Each parameter must be separated by a comma and must have a value associated with it in the function's parameter list.
For a list of the parameters that you can specify, see the documentation for the MQMD structure in the WebSphere MQ Application Programming Reference at www.ibm.com.
value
Numeric or character, input or output
Provides a value for a message descriptor parameter specified in the parms string. You must provide a value parameter for each message descriptor parameter specified in the parms string and the data type must be of the proper type. Variables used to store character values that are being returned in an inquiry (INQ action) should be initialized appropriately to guarantee that truncation of a returned value does not occur.
Note:This routine supports both sending a message (MQPUT and MQPUT1) and receiving a message (MQGET). Therefore, the parameters and values serve as both input and as output to the function.

Details

ENCODING and CODEDCHARSETID should not be set in most situations since you want a message to be described by its native numeric and character encoding, which are the default attributes for these parms.
FORMAT should be set if you intend for a WebSphere MQ QMgr conversion exit to be invoked when an application GETs a message. The FORMAT name is the actual name of the conversion exit that is invoked when an application GETs a message with the CONVERT get message option specified. The FORMAT name in the message descriptor is set when a message is PUT on a queue. Refer to WebSphere MQ literature for details about creating a conversion exit.
MSGID and CORRELID are updated on PUTs and GETs, so remember to reset their values appropriately when performing multiple PUTs or GETs with the same message descriptor.

Example

This example sends a message to a queue, and then queries and displays the message descriptor values.
   length parms $ 57;
   length report $ 30 msgtype $ 8 msgid $ 48 correlid $48
      applname $ 28 putdate $ 8 puttime $ 8;
   /* generate a message descriptor to PUT a persistent */
   /* message on a permanent queue                       */
   hmd=0;
   action="GEN";
   rc=0;
   parms="PERSISTENCE"
   persist="PERSISTENT";
   CALL MQMD(hmd, action, rc, parms, persist);
   /* inquire about message descriptor values after GET  */
   /* operation completes successfully                   */
   action="INQ";
   parms="REPORT,MSGTYPE,MSGID,CORRELID,
      PUTAPPLNAME,PUTDATE,PUTTIME";
   CALL MQMD(hmd, action, rc, parms, report, msgtype,
      msgid, correlid, applname, putdate, puttime);
   put 'report type is ' report;
   put 'message type is ' msgtype;
   put 'message id is ' msgid;
   put 'correlation id is ' correlid;
   put 'put application name is ' applname;
   put 'put date is ' putdate;
   put 'put time is '
puttime;