Contents MQSeries Interface Previous Next

MQSeries CALL Routines




MQCONN

Connects base SAS to a MQSeries queue manager.

Syntax

CALL MQCONN(name, hConn, compCode, reason);

name
Character48, input
Specifies a case-sensitive identifier (name) of the queue manager that has previously been configured by the system administrator.

hConn
Numeric, output
Returns the MQSeries connection handle. This parameter is used other CALL routines to identify the connection created by MQCONN.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies compCode.

Note: A reason code of -1 reflects a SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

Example

The following example connects the base SAS session to the queue manager named TEST.

   hConn=0;
   Name="TEST";
   compCode=0;
   reason=0;
   CALL MQCONN(Name, hConn, compCode, reason);


MQDISC

Breaks the connection between a MQSeries queue manager and base SAS.

Syntax

CALL MQDISC(hConn, compCode, reason);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, compCode will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies compCode.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

Example

The following example disconnects the base SAS session from a queue manager identified by the parameter hConn.

   compCode=0;
   reason=0;
   CALL MQDISC(hConn, compCode, reason);


MQOPEN

Establishes access to an MQSeries object (queue, process definition, or queue manager).

Syntax

CALL MQOPEN(hConn, hod, options, hObj, compCode, reason <, compCode1, reason1, compCode2, reason2, ...>);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

hod
Numeric, input
Specifies the base SAS internal object descriptor handle obtained from a previous MQOD function call.

options
Character, input
Specifies a String of open options each separated by a comma. Valid open options are:

INPUT_AS_Q_DEF
Open to get messages using queue-defined default.

INPUT_SHARED
Open to get messages with shared access.

INPUT_EXCLUSIVE
Open to get messages with exclusive access.

BROWSE
Open to browse messages.

OUTPUT
Open to put messages.

INQUIRE
Open to query object attributes.

SET
Open to set object attributes.

SAVE_ALL_CONTEXT
Save context when message is received.

PASS_IDENTITY_CONTEXT
Allow identity context to be passed.

PASS_ALL_CONTEXT
Allow all context to be passed.

SET_IDENTITY_CONTEXT
Allow identity context to be set.

SET_ALL_CONTEXT
Allow all context to be set.

ALTERNATE_USER_AUTHORITY
Validate with specified user identifier.

FAIL_IF_QUIESCING
Fail if QMgr is quiescing.

hObj
Numeric, output
Returns the MQSeries handle that will be used in subsequent message queuing calls to identify the object being accessed (a queue, a process definition, or queue manager).

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies compCode.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

compCodex, reasonx
Numeric, output
The compCodex and reasonx are an optional series of paired values that can be used when opening a distribution list in order to discern failures for specific queues within the distribution list. These parameters support MQSeries Version 5.1 features.

Example

This example opens a queue for input and output.

   options="INPUT_SHARED,OUTPUT";
   hObj=0;
   compCode=0;
   reason=0;
   CALL MQOPEN(hConn, hod, options, hObj, compCode, reason);


MQCLOSE

Relinquishes access to an MQSeries object (queue, process definition, queue manager).

Syntax

CALL MQCLOSE(hConn, hObj, options, compCode, reason);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

hObj
Numeric, input
The hObj Specifies the MQSeries handle to an open object that was obtained from a previous MQOPEN call.

options
Character, input
Specifies a string of options each separated by a comma. Valid close options are:

NONE
No optional close processing required.

DELETE
Delete the permanent dynamic queue if no messages exist and no uncommitted get or put request is outstanding.

DELETE_PURGE
Delete and purge any messages on the permanent dynamic queue if no uncommitted get or put request is outstanding.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

Example

This example closes a queue.

   options="NONE";
   compCode=0;
   reason=0;
   CALL MQCLOSE(hConn, hObj, options, compCode, reason);


MQPUT

Puts a message on a MQSeries queue that has been previously opened.

Syntax

CALL MQPUT(hConn, hObj, hmd, hpmo, hData, compCode, reason <, compCode1, reason1, compCode2, reason2, ...>);

hConn
Numeric, input
Specifies the MQSeries Connection handle obtained from a previous MQCONN function call.
hObj
Numeric, input
Specifies the MQSeries handle to an open object that was obtained from a previous MQOPEN call.

hmd
Numeric, input
Specifies the base SAS internal message descriptor handle obtained from a previous MQMD function call.

hpmo
Numeric, input
Specifies the base SAS internal put message options handle obtained from a previous MQPMO function call.

hData
Numeric, input
Specifies the base SAS internal data descriptor handle obtained from a previous MQSETPARMS function call. If set to zero, it is assumed that no data will accompany this message.

For MQSeries Version 5.1, hData can also represent a reference message header obtained from a previous MQRMH function call.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies compCode.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

compCodex, reasonx
Numeric, output
The compCodex and reasonx are an optional series of paired values that can be used when opening a distribution list in order to discern failures for specific queues within the distribution list. These parameters support MQSeries Version 5.1 features.

Example

This example sends a message to a queue.

   compCode=0;
   reason=0;
   CALL MQPUT(hConn, hObj, hmd, hpmo, hData, compCode, reason);


MQPUT1

Sends a single message, often a reply, to a queue.

Syntax

CALL MQPUT1(hConn, hod, hmd, hpmo, hData, compCode, reason <, compCode1, reason2, compCode2, reason2, ...>);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).
hod
Numeric, input)
Specifies the base SAS internal object descriptor handle obtained from a previous MQOD function call.

hmd
Numeric, input
Specifies the base SAS internal message descriptor handle obtained from a previous MQMD function call.

hpmo
Numeric, input
Specifies the base SAS internal put message options handle obtained from a previous MQPMO function call.

hData
Numeric, input
Specifies the base SAS internal data descriptor handle obtained from a previous MQSETPARMS function call. If set to zero, it is assumed that no data will accompany this message.

For MQSeries Version 5.1, hData can also represent a reference message header obtained from a previous MQRMH function call.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

compCodex, reasonx
Numeric, output
The compCodex and reasonx are an optional series of paired values that can be used when opening a distribution list in order to discern failures for specific queues within the distribution list. These parameters support MQSeries Version 5.1 features.

Details

Essentially, the MQPUT1 routine performs an MQOPEN, MQPUT and MQCLOSE in one API call. Note that the queue does not have to be open prior to making this call. Also note that the queue will be closed during the execution of this call.

Example

This example sends a message to a queue that may not be opened.

   compCode=0;
   reason=0;
   CALL MQPUT1(hConn, hod, hmd, hpmo, hData, compCode, reason);


MQGET

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

Syntax

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

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

hObj
Numeric, input
Specifies the MQSeries handle to an open object that was obtained from a previous MQOPEN call.

hmd
Numeric, input
Specifies the base SAS internal message descriptor handle obtained from a previous MQMD function call.

hgmo
Numeric, input
Specifies the base SAS internal get message options handle 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 which case there will be no need to call MQGETPARMS.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), 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);


MQCMIT

Commits all MQSeries message puts and gets since the last syncpoint.

Syntax

CALL MQCMIT(hConn, compCode, reason);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

Example

This example commits a unit of work.

   compCode=0;
   reason=0;
   CALL MQCMIT(hConn, compCode, reason);


MQBACK

Backs out all MQSeries message puts and gets since the last syncpoint.

Syntax

CALL MQBACK(hConn, compCode, reason);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

Example

This example reverts the messages in a queue back to the last synchronization point.

   compCode=0;
   reason=0;
   CALL MQBACK(hConn, compCode, reason);


MQINQ

Queries the attributes of an MQSeries object (queue, process definition, queue manager).

Syntax

CALL MQINQ(hConn, hObj, compCode, reason, parms, value1 <,value2, ...>);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

hObj
Numeric, input
Specifies the MQSeries Object handle obtained from a previous MQOPEN function call that specified the INQUIRE option. This handle can represent a queue, process definition, or queue manager object.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

parms
Character, input
Specifies a string of attributes that you wish to query from the MQSeries object. Each object attribute is separated by a comma. The value associated with each attribute is returned in a value parameter. Not all attributes are valid for each type of object (queue, process definition, or queue manager).

value
Numeric/character, output
Returns the value for an attribute specified in the parms string. You must provide a value parameter for each attribute specified parms string. Variables used to store character values should be initialized appropriately to guarantee that truncation of a returned value does not occur.

Valid attributes and values types are:

Numeric Output Types:

APPL_TYPE
Application type
CODED_CHAR_SET_ID
Coded character set identifier
CURRENT_Q_DEPTH
Number of messages on queue
DEF_INPUT_OPEN_OPTION
Default open-for-input option
DEF_PERSISTENCE
Default message persistence
DEF_PRIORITY
Default message priority
DEFINITION_TYPE
Queue definition type
HARDEN_GET_BACKOUT
Whether to harden backout count
INHIBIT_GET
Whether get operations are allowed
INHIBIT_PUT
Whether put operations are allowed
MAX_HANDLES
Maximum number of handles
USAGE
Usage
MAX_MSG_LENGTH
Maximum message length
MAX_PRIORITY
Maximum priority
MAX_Q_DEPTH
Maximum number of messages allowed on queue
MSG_DELIVERY_SEQUENCE
Whether message priority is relevant
OPEN_INPUT_COUNT
Number of MQOPEN calls that have the queue open for input
OPEN_OUTPUT_COUNT
Number of MQOPEN calls that have the queue open for output
NAME_COUNT
Number of queues in namelist
Q_TYPE
Queue type
RETENTION_INTERVAL
Queue retention interval
BACKOUT_THRESHOLD
Backout threshold
SHAREABILITY
Whether queue can be shared
TRIGGER_CONTROL
Trigger control
TRIGGER_INTERVAL
Trigger interval
TRIGGER_MSG_PRIORITY
Threshold message priority for triggers
TRIGGER_TYPE
Trigger type
TRIGGER_DEPTH
Trigger depth
SYNCPOINT
Syncpoint availability
COMMAND_LEVEL
Command level supported by queue manager
PLATFORM
Platform on which the queue manager resides
MAX_UNCOMMITTED_MSGS
Maximum number of uncommitted messages within a unit of work
TIME_SINCE_RESET
Time since last reset
HIGH_Q_DEPTH
High depth reached
MSG_ENQ_COUNT
Message enqueue count
MSG_DEQ_COUNT
Message dequeue count
Q_DEPTH_HIGH_LIMIT
High limit for queue depth
Q_DEPTH_LOW_LIMIT
Low limit for queue depth
Q_DEPTH_MAX_EVENT
Control attribute for queue depth max events
Q_DEPTH_HIGH_EVENT
Control attribute for queue depth high events
Q_DEPTH_LOW_EVENT
Control attribute for queue depth low events
SCOPE
Queue definition scope
Q_SERVICE_INTERVAL_EVENT
Control for queue service interval events
AUTHORITY_EVENT
Control attribute for authority events
INHIBIT_EVENT
Control attribute for inhibit events
LOCAL_EVENT
Control attribute for local events
REMOTE_EVENT
Control attribute for remote events
START_STOP_EVENT
Control attribute for start stop events
PERFORMANCE_EVENT
Control attribute for performance events
Q_SERVICE_INTERVAL
Limit for queue service interval

Character8 Output Types:

CREATION_TIME
Queue creation time

Character12 Output Types:

CREATION_DATE
Queue creation date

Character48 Output Types:

BASE_Q_NAME
Name of queue to which alias resolves
COMMAND_INPUT_Q_NAME
System command input queue name
DEAD_LETTER_Q_NAME
Dead letter queue name
INITIATION_Q_NAME
Initiation queue name
PROCESS_DESC
Description of process definition
PROCESS_NAME
Name of process definition
Q_MGR_NAME
Queue manager name
Q_NAME
Queue name
REMOTE_Q_MGR_NAME
Name of remote queue manager
REMOTE_Q_NAME
Name of remote queue as known on remote queue manager
BACKOUT_REQ_Q_NAME
Excessive backout requeue name
XMIT_Q_NAME
Default transmission queue name

Character64 Output Types:

Q_DESC
Queue description
Q_MGR_DESC
Queue manager description
TRIGGER_DATA
Trigger data

Character128 Output Types:

ENV_DATA
Environment data
USER_DATA
User data

Character256 Output Types:

APPL_ID
Application identifier

Example

This example queries about a queue's maximum depth and the maximum message length.

   length parms $ 30;
   compCode=0;
   reason=0;
   parms="MAX_Q_DEPTH,MAX_MSG_LENGTH";
   CALL MQINQ(hConn, hObj, compCode, reason, parms, maxdepth, maxmsgl);


MQSET

Changes the attributes of a queue object.

Syntax

CALL MQSET(hConn, hObj, compCode, reason, parms, value1 <,value2, ...>);

hConn
Numeric, input
Specifies the MQSeries connection handle (obtained from a previous MQCONN function call).

hObj
Numeric, input
Specifies the MQSeries object handle obtained from a previous MQOPEN function call that specified the SET option. This handle represents a queue object.

compCode
Numeric, output
Returns the MQSeries completion code. This parameter can be used to determine if an error occurred during the execution of this routine. If an error occurred, the compCode parameter will be non-zero, and the reason parameter will be set to the appropriate reason code.

reason
Numeric, output
Returns the MQSeries reason code that qualifies the completion code.

Note: A reason code of -1 reflects a base SAS internal error, not an MQSeries error. To obtain a textual description of a failure (either base SAS or MQSeries), use the SYSMSG() base SAS function call.

parms
Character, input
Specifies a string of queue attributes that you wish to set for an MQSeries queue. Each queue attribute must be separated by a comma and must have a value associated with it. Only certain attributes (a subset of list for MQINQ) can be changed using this function call. Refer to the IBM MQSeries documentation for more details.

value
Numeric/character, input
Provides the value for an attribute specified in the parms string. You must provide a value parameter for each attribute specified in the parms string and the data type must be of the proper type.

Example

This example changes the queue properties by inhibiting messages to be sent (put) to the queue.

   length parms $ 30;
   compCode=0;
   reason=0;
   parms="INHIBIT_PUT";
   inhibit=1;
   CALL MQSET(hConn, hObj, compCode, reason, parms, inhibit);


MQPMO

Manipulates MQSeries put message options to be used on a subsequent MQPUT call.

Syntax

CALL MQPMO(hpmo, action, rc <,parms ,value1, value2, ...>);

hpmo
Numeric, input/output
On input, it specifies the base SAS internal put message options handle. The handle should be supplied when you are setting or querying an option. The handle is generated as output when action is to generate default MQSeries put options.

action
Character, input
Specifies the desired action of this routine. Valid action values are:

GEN
Generate a handle representing default put message options as defined by MQSeries.
SET
After a put message options handle has been generated, you can continue to set values as necessary.
INQ
After a put message options handle has been generated, you can query its values.
rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Character, input
Specifies an optional string of put message options that you wish to set for subsequent MQPUT calls. Each option must be separated by a comma and must have a value associated with it in the function's parameter list.

value
Numeric/Character, input/output
Provides the value for an option specified in the parms string. You must provide a value parameter for each option specified in the parms string and the data type must be of the proper type. Variables used to store character values being returned in an inquiry (INQ action) should be initialized appropriately to guarantee that truncation of a returned value does not occur.

Valid put message options (parms) are:

CONTEXT
Numeric, input
Object handle of input queue.

RESOLVEDQNAME
Character48, output
Resolved name of destination queue.

RESOLVEDQMGRNAME
Character48, output
Resolved name of destination queue manager.

OPTIONS
Character, input
Character string of the attributes (options) to associate with subsequent MQPUT calls. Each option must be separated by a comma.

Valid OPTIONS values are:

NONE
Default

SYNCPOINT
Put message inside current unit of work

NO_SYNCPOINT
Put message outside current unit of work

DEFAULT_CONTEXT
Associate default context with the message

PASS_IDENTITY_CONTEXT
Pass identity context from an input queue handle

PASS_ALL_CONTEXT
Pass all context from an input queue handle

SET_IDENTITY_CONTEXT
Set identity context from the application

SET_ALL_CONTEXT
Set all context from the application

ALTERNATE_USER_AUTHORITY
Validate with specified user identifier

FAIL_IF_QUIESCING
Fail if QMgr is quiescing

NO_CONTEXT
Associate no context with the message

The following OPTIONS values support MQSeries Version 5.1:

NEW_MSGID
Generate a new message identifier

NEW_CORRELID
Generate a new correlation identifier

LOGICAL_ORDER
Messages in groups and segments will be put in logical order

The following OPTIONS values support MQSecure features:

ENCRYPT
Encrypt the message

SIGN
Digitally sign the message

Example

This example demonstrates the generate, set and inquire actions of MQPMO routine.

   length parms $ 30;
   length rq rqmgr $ 48;

   /* generate default put message options */
   hpmo=0;
   action="GEN";
   rc=0;
   CALL MQPMO(hpmo, action, rc);

   /* set non-default put message options parameters */
   action="SET";
   parms="OPTIONS";
   options="SYNCPOINT,FAIL_IF_QUIESCING";
   CALL MQPMO(hpmo, action, rc, parms, options);

   /* inquire about resolved names after successful PUT */
   action="INQ";
   parms="RESOLVEDQNAME,RESOLVEDQMGRNAME";
   CALL MQPMO(hpmo, action, rc, parms, rq, rqmgr);


MQGMO

Manipulates MQSeries get message options to be used on a subsequent MQGET call.

Syntax

CALL MQGMO(hgmo, action, rc <,parms ,value1,value2, ...>);

hgmo
Numeric, input/output
On input, it specifies a base SAS internal get message options handle. The handle should be supplied when you are setting or querying an option. The handle is generated as output when action is to generate default MQSeries get options.

action
Character, input
Specifies the desired action of this routine. Valid action values are:

GEN
Generate a handle representing default get message options as defined by MQSeries.
SET
After a get message options handle has been generated, you can continue to set values as necessary.
INQ
After a get message options handle has been generated, you can query its values.
rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Character, input
Specifies an optional string of get message options that you wish to set for subsequent MQGET calls. Each option must be separated by a comma and must have a value associated with it in the function's parameter list.

value
Numeric/character, input/output
Provides the value for a get message option specified in the parms string. You must provide a value parameter for each option specified in the parms string and the data type must be of the proper type. Variables used to store character values being returned in an inquiry (INQ action) should be initialized appropriately to guarantee that truncation of a returned value does not occur.

Valid get message options (parms) and values are:

OPTIONS
Character, input
Specifies a string of the attributes (options) to associate with subsequent MQPUT calls. Each option must be separated by a comma.

Valid OPTIONS values are:

NONE
Used to unset previously set OPTIONS

NO_WAIT (default)
Return immediately if no suitable message

WAIT
Wait for message to arrive

SYNCPOINT
Get message with syncpoint control

NO_SYNCPOINT
Get message without syncpoint control

BROWSE_FIRST
Browse from start of queue

BROWSE_NEXT
Browse from current position in queue

MSG_UNDER_CURSOR
Get message under browse cursor

LOCK
Lock message

UNLOCK
Unlock message

BROWSE_MSG_UNDER_CURSOR
Browse message under browse cursor

FAIL_IF_QUIESCING
Fail if QMgr is quiescing

CONVERT
Convert message data

The following OPTIONS values support MQSeries Version 5.1:

LOGICAL_ORDER
Messages in groups and segments of logical messages are returned in logical order

COMPLETE_MSG
Only complete logical messages are retrievable

ALL_MSGS_AVAILABLE
All messages in a group must be available

ALL_SEGMENTS_AVAILABLE
All segments in a logical message must be available

Notes:
  • ACCEPT_TRUNCATED_MSG is not allowed since base SAS will internally maintain resizing of the internal GET buffer to handle any message size.
  • Specify CONVERT to allow MQSeries to perform data conversion based on the FORMAT of a PUT message via a conversion exit routine that has been previously established at the QMgr. To allow base SAS to perform the data conversion instead of using a MQSeries conversion exit routine, then do not specify the CONVERT option.

WAITINTERVAL
Numeric, input
Amount of time to wait for message to arrive in milliseconds.

RESOLVEDQNAME
Character48, output
Resolved name of destination queue.

The following get message options are supported by MQSeries Version 5.1:

MATCHOPTIONS
Character, input
Character string of match options used to control selection criteria associate with subsequent MQGET calls. Each option must be separated by a comma.

Valid MATCHOPTIONS values are:

NONE
No matches

MSGID
Retrieve message with specified message identifier

CORRELID
Retrieve message with specified correlation identifier

GROUPID
Retrieve message with specified group identifier

SEQNUMBER
Retrieve message with specified sequence number

OFFSET
Retrieve message with specified offset

GROUPSTATUS
Character, output
Flag indicating whether message was retrieved within a group.

SEGMENTSTATUS
Character, output
Flag indicating whether message was retrieved within a segment of a logical message.

SEGMENTATION
Character, output
Flag indicating whether further segmentation is allowed for the retrieved message.

Example

This example generates get message options to wait 3 seconds for a GET message operation.

   hgmo=0;
   action="GEN";
   rc=0;
   parms="OPTIONS,WAITINTERVAL";
   options="WAIT"
   interval=3000;
   CALL MQGMO(hgmo, action, rc, parms, options, interval);


MQOD

Manipulates object descriptor parameters to be used on a subsequent MQOPEN or MQPUT1 call.

Syntax

CALL MQOD(hod, action, rc <,parms ,value1, value2, ...>);

hod
Numeric, input/output
On input, it specifies a base SAS internal object 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 object descriptor parameters.

action
Character, input
Specifies the desired action of this routine. Valid action values are:

GEN
Generate a handle representing default object descriptor parameters as defined by MQSeries.
SET
After an object descriptor handle has been generated, you can continue to set values as necessary.
INQ
After an object 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 occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Character, input
Specifies an optional string of object descriptor parameters that you wish to set for subsequent MQOPEN or MQPUT1 calls. Each parameter must be separated by a comma and must have a value associated with it in the function's parameter list.

value
Numeric/character, input/output
Provides a value for an object descriptor parameter specified in the parms string. You must provide a value parameter for each object descriptor parameter specified in the parms string and the data type must be of the proper type. Variables used to store character values being returned in an inquiry (INQ action) should be initialized appropriately to guarantee that truncation of a returned value does not occur.

Valid object descriptor parameters (parms) and values are:

OBJECTTYPE
Character, input
A string containing the object type. Possible OBJECTTYPE values are:
  • Q (queue)
  • PROCESS (process)
  • Q_MGR (queue manager)

OBJECTNAME
Character48, input/output
Object name

OBJECTQMGRNAME
Character48, input/output
Object queue manager name

DYNAMICQNAME
Character48, input
Dynamic queue name.

ALTERNATEUSERID
Character12, input
Alternate user identifier

The following parameters support MQSeries Version 5.1:

DISTLIST
Character, input
Character string of queues in a distribution list each separated by commas (input). The format of a queue name is <qmgr.>queue.

Example

This example generates an object descriptor to OPEN a temporary dynamic queue that begins with the name base SAS and is unique within the system. The example then queries the name of the temporary dynamic queue that was created after a successful OPEN.

   length qname $ 48;
   hod=0;
   action="GEN";
   rc=0;
   parms="OBJECTNAME,DYNAMICQNAME"
   model="SAMPLE.TEMP.MODEL";
   qname="SAS*";
   CALL MQOD(hod, action, rc, parms, model, qname);

   action="INQ";
   parms="OBJECTNAME";
   CALL MQOD(hod, action, rc, parms, qname);

   put 'dynamic queue name = ' qname;


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, ...>);

hmd
Numeric, input/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. Valid action values are:

GEN
Generate a handle representing default message descriptor parameters as defined by MQSeries.
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 occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Character, input
Specifies an optional string of message descriptor parameters that you wish 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.

value
Numeric/Character, input/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 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.

Valid message descriptor parameters (parms) and values are:

REPORT
Character, input (PUT call) / output (GET call)
Character string of the report options to associate with subsequent function calls. Each option must be separated by a comma.

Possible REPORT option values are:

NONE
No reports required

PASS_CORREL_ID
Pass correlation identifier

PASS_MSG_ID
Pass message identifier

COA
Confirmation-on-arrival reports required

COA_WITH_DATA
Confirmation-on-arrival reports with data required

COA_WITH_FULL_DATA
Confirmation-on-arrival reports with full data required

COD
Confirmation-on-delivery reports required

COD_WITH_DATA
Confirmation-on-delivery reports with data required

COD_WITH_FULL_DATA
Confirmation-on-delivery reports with full data required

EXPIRATION
Expiration reports required

EXPIRATION_WITH_DATA
Expiration reports with data required

EXPIRATION_WITH_FULL_DATA
Expiration reports with full data required

EXCEPTION
Exception reports required

EXCEPTION_WITH_DATA
Exception reports with data required

EXCEPTION_WITH_FULL_DATA
Exception reports with full data required

DISCARD_MSG
Discard message if undeliverable

The following REPORT option values support MQSeries Version 5.1:

PAN
Positive action notification report required

NAN
Negative action notification report required

MSGTYPE
Numeric, input (Put call)/output (Get call)
Message type. MQSeries reserves the following message types:

1
MQMT_REQUEST
2
MQMT_REPLY
3
MQMT_REPORT
8
MQMT_DATAGRAM

Note: Application defined message types start at 65536 (MQMT_APPL_FIRST).

EXPIRY
Numeric, input (Put call)/output (Get call)
Expiry time

FEEDBACK
Numeric, input (Put call)/output (Get call)
Feedback code

ENCODING
Numeric, input (Put call)/output (Get call)
Data encoding

CODEDCHARSETID
Numeric, input (Put call)/output (Get call)
Coded character set identifier

FORMAT
Character8, input (Put call)/output (Get call)
Format name

PRIORITY
Numeric, input (Put call)/output (Get call)
Message priority

PERSISTENCE
Character, input (Put call)/output (Get call)
Message persistence. Possible persistence values are:

NOT_PERSISTENT
Message is not persistent

PERSISTENT
Message is persistent

PERSISTENT_AS_Q_DEF
Message has default persistence

MSGID
Character, input/output
Message identifier character string representing binary data (2x24 characters: binary format).

CORRELID
Character, input (PUT call) / input/output (GET call)
Correlation identifier character string representing binary data (2x24 characters: binary format).

BACKOUTCOUNT
Numeric, output (GET call)
Backout counter

REPLYTOQ
Character48, input (PUT call) / output (GET call)
Name of reply-to-queue

REPLYTOQMGR
Character, input (PUT call) / output (GET call)
Name of reply queue manager

USERIDENTIFIER
Character12, input/output (PUT call) / output (GET call)
User identifier

ACCOUNTINGTOKEN
Character, input/output (PUT call) / output( GET call)
Accounting token character string representing binary data (2x32 characters: binary format).

APPLIDENTITYDATA
Character32, input/output (PUT call) / output (GET call)
Application data relating to identity

PUTAPPLTYPE
Numeric, input/output (PUT call) / output (GET call)
Type of application that put the message

PUTAPPLNAME
Character28, input/output (PUT call) / output (GET call)
Name of application that put the message

PUTDATE
Character8, input/output (PUT call) / output (GET call)
Date when message was put

PUTTIME
Character8, input/output (PUT call) / output (GET call)
Time when message was put on the queue

APPLORIGINDATA
Character4, input/output (PUT call) / output (GET call)
Application data relating to origin

The following parameters/values support MQSeries Version 5.1:

GROUPID
Character, input/output (PUT call) / input/output (GET call)
Group identifier character string representing binary data (2x24 characters: binary format).

MSGSEQNUMBER
Numeric, input/output (PUT call) / input/output (GET call)
Sequence number of logical message within group

OFFSET
Numeric, input/output (PUT call) / input/output (GET call)
Offset of data in physical message from start of logical message

MSGFLAGS
Numeric, input (PUT call) / output (GET call)
The following message flags are supported:

1
MQMF_SEGMENTATION_ALLOWED
2
MQMF_SEGMENT
4
MQMF_LAST_SEGMENT
8
MQMF_MSG_IN_GROUP
16
MQMF_LAST_MSG_IN_GROUP

Notes:

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 an 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;


MQMAP

Defines a data map that can be subsequently used on a MQSETPARMS or MQGETPARMS call.

Syntax

CALL MQMAP(hMap, rc, desc1 <,desc2, desc3, ...>);

hMap
Numeric, output
Returns a base SAS internal map descriptor handle. The handle generated will be used to reference the data map when setting or getting base SAS variables in a message.

rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

descs
Character, input
Specifies a data map descriptor that defines the data type, data offset from the beginning of the message, and data length. A descriptor has the following format:

"TYPE<,OFFSET,LENGTH>"
Where TYPE can be one of the following values:

  • CHAR (character data)
  • SHORT (short integer)
  • LONG (long integer)
  • DOUBLE (double precision floating point)

OFFSET is the offset from beginning of the message. This property is optional so that by default data is not aligned (data starts at next available position in message).

LENGTH is the length of the data being represented. This property is optional in most cases. The only time length is required is when setting up to receive character data. Specifying length for numeric data is ignored since length is implicitly defined.

Note: Type coercion is performed transparently when you put base SAS variables into a MQSeries message (MQSETPARMS) and also when you get base SAS variables from a MQSeries message (MQGETPARMS). That is, if the data that you are sending or receiving is of a different type than the base SAS variable itself, the data will be coerced into the appropriate data type.

Example

This example defines a map to use to send and receive a message with a short, a long, a double and a character string. No alignment is specified for any data type, and strings will always be 200 characters in length (blank padded).

   hMap=0;
   rc=0;
   desc1="SHORT";
   desc2="LONG";
   desc3="DOUBLE";
   desc4="CHAR,,200"
   CALL MQMAP(hMap, rc, desc1, desc2, desc3, desc4);


MQSETPARMS

Creates a data descriptor that describes the actual base SAS variables along with an associated data mapping. This data descriptor can then be used on a subsequent MQPUT or MQPUT1 call.

Syntax

CALL MQSETPARMS(hData, hMap, rc, parm1 <,parm2, parm3, ...>);

hData
Numeric, output
Returns a base SAS internal data descriptor handle. The handle generated can be used to reference the data when when sending a message to a queue.

hMap
Numeric, input
Specifies a base SAS internal map descriptor handle obtained from a previous MQMAP function call. If set to zero, no external defined mapping is assumed and therefore, all data will be mapped according to base SAS internal representations. That is, all numerics will be mapped as doubles and all strings will be mapped as character data of the current string length.

rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Numeric/character, input
Specifies the base SAS variables to set.

Example

This example sets values of base SAS variables into a message.

   hData=0;
   rc=0;
   parm1=100;
   parm2=9999;
   parm3=9999.9999;
   parm4="This is a test."
   CALL MQSETPARMS(hData, hMap, rc, parm1, parm2, parm3, parm4);


MQGETPARMS

Retrieves values of base SAS variables from a previous MQSeries message that was received by a MQGET call.

Syntax

CALL MQGETPARMS(hMap, rc, parm1 <,parm2, parm3, ...>);

hMap
Numeric, input
Specifies a handle to a base SAS internal map descriptor obtained from a previous MQMAP function call.

rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Numeric/character, output
Returns the the base SAS variables.

Note: Initialize variables appropriately to guarantee that truncation does not occur.

Details

This message is available until the next MQGET call is performed.

Example

This example gets values of base SAS variables from a received message.

   length parm1 parm2 parm3;
   length parm4 $ 200;

   rc=0;
   CALL MQGETPARMS(hMap, rc, parm1, parm2, parm3, parm4);


MQRMH

Creates or manipulates a reference message header so that an application can put a message in this format, omitting the bulk data.

Syntax

CALL MQRMH(hrmh, action, rc, parms, value1, value2, ...);

hrmh
Numeric, input/output
Specifies a base SAS internal handle to a reference message header. The handle is generated as output when action is to generate default message header parameters. The handle should be supplied when you are setting or querying a parameter.

action
Character, input
Specifies the desired action of this routine. Valid action values are:

GEN
Generate a handle representing default reference message header parameters as defined by MQSeries.
SET
After a message header handle has been generated, you can set values as necessary.
INQ
After a message header handle has been generated, you can query its values.
rc
Numeric, output
Provides the base SAS return code from this function. If an error occurred, the return code will be non-zero. The base SAS function SYSMSG() can be used to obtain a textual description of the return code.

parms
Character, input
Specifies an optional string of reference message header parameters that you wish to set. Each parameter must be separated by a comma and must have a value associated with it in the function's parameter list. The OBJECTTYPE, SCRNAME, and DESTAME parameters should be defined.

value
Numeric/character, input/output
Provides a value for a reference message header parameter specified in the parms string. You must provide a value parameter for each reference message header parameter specified in the parms string and the data type must be of the proper type. Variables used to store character values being returned in an inquiry (INQ action) should be initialized appropriately to guarantee that truncation of a returned value does not occur.

Valid reference message header parameters (parms) and values are:

ENCODING
Numeric, input
Data encoding

CODEDCHARSETID
Numeric, input
Coded character set identifier

FORMAT
Character8, input
Format name

OBJECTTYPE
Character8, input
Object type

SRCNAME
Character, input
Source object name

DESTNAME
Character, input
Destination object name

Details

This is a new function that supports MQSeries Version 5.1.

When the reference message header is read from the transmission queue by a message channel agent (MCA), a user-supplied message exit is invoked to process the reference message. A sample message exit is supplied by MQSeries, amqsxrm. You will need to add this message exit to the sending and receiving channel definitions. The message exit on the sending side can append to the reference message the bulk data identified by the reference message header before the MCA sends the message through the channel to the next queue manager. When a reference message is received, the receiving message exit should create the object from the bulk data that is associated with the reference message header, and then pass on the reference message without the bulk data so that the reference message (without the bulk data) can later be retrieved by a program.

Example

This example goes through the process of connecting to a queue manager, preparing the queue, generating the message, closing the queue, and freeing all resources.

data _null_;
length hconn hobj cc reason 8;
length rc hod hpmo hmd hrmh 8;
length msg $ 200;

hconn=0;
hobj=0;
hod=0;
hpmo=0;
hmd=0;
hrmh=0;

put '---------------- Connect to QMgr --------------';
call mqconn("TESTQMGR", hconn, cc, reason);
if cc ^= 0 then do;
  if reason = 2002 then do;
    put 'Already connected to QMgr ' qmgr;
  end;
  else do;
    if reason = 2059 then
     put 'MQCONN: QMgr not available... needs to be started';
    else
     put 'MQCONN: failed with reason= ' reason;
    goto exit;
  end;
end;
else put 'MQCONN: successfully connected to QMgr ' qmgr;


put '---------- Generate object descriptor ---------';
call mqod(hod, "GEN", rc, "OBJECTNAME", "TESTQ");
if rc ^= 0 then do;
  put 'MQOD: failed with rc= ' rc;
  msg = sysmsg();
  put msg;
  goto exit;
end;
else put 'MQOD: successfully generated object descriptor';


put '-------- Open queue object for output ---------';
call mqopen(hconn, hod, "OUTPUT", hobj, cc, reason);
if cc ^= 0 then do;
  put 'MQOPEN: failed with reason= ' reason;
  goto exit;
end;
else put 'MQOPEN: successfully opened queue for output';


put '--------- Generate put message options --------';
call mqpmo(hpmo, "GEN", rc);
if rc ^= 0 then do;
  put 'MQPMO: failed with rc= ' rc;
  msg = sysmsg();
  put msg;
  goto exit;
end;
else put 'MQPMO: successfully generated put message options';


put '--------- Generate message descriptor ---------';
/* format must be set to reference message header */
call mqmd(hmd, "GEN", rc, "PERSISTENCE,FORMAT", "PERSISTENT", "MQHREF");
if rc ^= 0 then do;
  put 'MQMD: failed with rc= ' rc;
  msg = sysmsg();
  put msg;
  goto exit;
end;
else put 'MQMD: successfully generated message descriptor';

/** reference message header **/
call mqrmh(hrmh, "GEN", rc, "SRCNAME,DESTNAME,OBJECTTYPE",
           "d:\test.txt", "d:\testdup.txt", "FLATFILE");
if rc ^= 0 then do;
  put 'MQRMH: failed with rc= ' rc;
  msg = sysmsg();
  put msg;
  goto exit;
end;
else put 'MQRMH: successfully generated reference message header';

put '------------- Put message on queue ------------';
call mqput(hconn, hobj, hmd, hpmo, hrmh, cc, reason);
if cc ^= 0 then do;
  put 'MQPUT: failed with reason= ' reason;
  msg = sysmsg();
  put msg;
  goto exit;
end;
else put 'MQPUT: successfully put message on queue';


exit:
if hobj ^= 0 then do;
  put '------------------ Close queue ----------------';
  call mqclose(hconn, hobj, "NONE", cc, reason);
  if cc ^= 0 then do;
    put 'MQCLOSE: failed with reason= ' reason;
  end;
  else put 'MQCLOSE: successfully closed queue';
end;


if hconn ^= 0 then do;
  put '------------- Disconnect from QMgr ------------';
  call mqdisc(hconn, cc, reason);
  if cc ^= 0 then do;
    put 'MQDISC: failed with reason= ' reason;
  end;
  else put 'MQDISC: successfully disconnected from QMgr';
end;


if hod ^= 0 then do;
  call mqfree(hod);
  put 'Object descriptor handle freed';
end;
if hpmo ^= 0 then do;
  call mqfree(hpmo);
  put 'Put message options handle freed';
end;
if hmd ^= 0 then do;
  call mqfree(hmd);
  put 'Message descriptor handle freed';
end;
if hrmh ^= 0 then do;
  call mqfree(hrmh);
  put 'Reference message header handle freed';
end;
run;


MQFREE

Frees a base SAS internal handle, thereby releasing its resources.

Syntax

CALL MQFREE(handle);

handle
Numeric, input
Specifies the base SAS internal handle obtained from one of the following previous function calls:

  • MQPMO (hpmo)
  • MQGMO (hgmo)
  • MQOD (hod)
  • MQMD (hmd)
  • MQMAP (hMap)
  • MQSETPARMS (hData)

The following new function supports MQSeries Version 5.1:

  • MQRMH (hrmh)

Example

This example frees the resources allocated by a handle.

   CALL MQFREE(handle);


Contents MQSeries Interface Previous Next

Copyright © 2025 SAS Institute Inc. All Rights Reserved.