MQGET

Retrieves a message from a local WebSphere MQ queue that has been previously opened.

Syntax

CALL MQGET(hConn, hObj, hmd, hgmo, msglen, compCode, reason);

Required Arguments

hConn
Numeric, input
Specifies the WebSphere MQ connection handle that is obtained from a previous MQCONN function call.
hObj
Numeric, input
Specifies the WebSphere MQ handle to an open object that is obtained from a previous MQOPEN call.
hmd
Numeric, input
Specifies the Base SAS internal message descriptor handle that is obtained from a previous MQMD function call.
hgmo
Numeric, input
Specifies the Base SAS internal get message options handle that is obtained from a previous MQGMO function call.
msglen
Numeric, output
Returns the length of the received message. A length of zero signifies a message with no data. In that case, there is no need to call MQGETPARMS.
compCode
Numeric, output
Returns the WebSphere MQ completion code. This parameter can be used to determine whether an error occurred during the execution of this routine. If an error occurred, then the compCode parameter will be nonzero, and the reason parameter will be set to the appropriate reason code.
reason
Numeric, output
Returns the WebSphere MQ reason code that qualifies the completion code.
Note: A reason code of -1 reflects a Base SAS internal error, not a WebSphere MQ error. To obtain a textual description of a failure (either Base SAS or WebSphere MQ), use the SYSMSG() Base SAS function call.

Details

If data accompanies the message, it is retrieved into an internal Base SAS buffer. After the MQGET call completes, you should call MQGETPARMS to set Base SAS variables (parms) to that data or to retrieve the data into a physical binary or text file.

Example

This example gets a message from a queue.
msglen=0;
compCode=0;
reason=0;
CALL MQGET(hConn, hObj, hmd, hgmo, msglen,
compCode,
reason);