IBM MQ APL Functions(4.0)

IBM MQ APL functions are used to send data to an IBM MQ queue.

MQConnect

This function will open a connection to a queue and queue manager.

MQQueue mqConnect(MQQueueManagerInfo info, string queueName)

Parameters


ParameterDescription

info

The information needed to connect to the queue manager MQQueueManagerInfo UDR. For further information about the MQQueueManagerInfo UDR type see MQQueueManagerInfo in IBM MQ UDRs(4.0).

queueName

The name of the queue

Returns

Returns an MQQueue UDR. For further information about the MQQueue UDR type see MQQueue in IBM MQ UDRs(4.0).

Note!

If there is no available queue status for some reason, the MaxDepth and CurrentDepth fields will be assigned the value "-1" and the mqConnect function will still be able to connect.

MQPut

This function will put a message on a queue.

If the function fails, it will populate the ErrorDescription field with a description and set isError to true. If the error was generated from an MQ exception it will also update the MqError field in the MQQueue UDR.

string mqPut(MQQueue queue, MQMessage message)

Parameters


ParameterDescription

queue

The MQQueue UDR that is the result from the mqConnect function. For further information about the MQQueue UDR type see MQQueue in IBM MQ UDRs(4.0)

message

The message to add to the queue. For further information about the MQMessage UDR type see MQMessage in IBM MQ UDRs(4.0).

Returns

Returns null if the function was successful and an error message if it failed.

MQClose

This function closes the connection to the queue manager.

If the function fails, it will populate the ErrorDescription field with a description and set isError to true. If the error was generated from an MQ exception it will also update the MqError field in the MQQueue UDR.

string mqClose(MQQueue queue)

Parameters


ParameterDescription

queue

The MQQueue UDR that is the result from the mqConnect function. For further information about the MQQueue UDR type see MQQueue in IBM MQ UDRs(4.0).

Returns

Returns null if the function was successful and an error message if it failed.

MQStatus

This function will query the queue for MaxDepth and CurrentDepth and populate the corresponding fields in the MQQueue UDR.

If the function fails, it will populate the ErrorDescription field with a description and set isError to true. If the error was generated from an MQ exception it will also update the MqError field in the MQQueue UDR.

string mqStatus(MQQueue queue)

Parameters


ParameterDescription

queue

The MQQueue UDR that is the result from the mqConnect function. For further information about the MQQueue UDR type see MQQueue in IBM MQ UDRs(4.0).

Returns

Returns an error message describing the problem, or null if the function was successful.