MQSession Class

This is the root class for WebSphere MQ Automation Classes for ActiveX.

There is always only one MQSession object per ActiveX client process.

An attempt to create a second object creates a second reference to the original object.

Creation

New creates a new MQSession object.

Syntax

Dim mqsess As New MQSession
Set mqsess = New MQSession

Properties

Methods

CompletionCode property

Read-only. Returns the WebSphere MQ completion code set by the most recent method or property set issued against any WebSphere MQ object.

It is reset to MQCC_OK when a method or a property set is invoked successfully against any MQAX object.

An error event handler can inspect this property to diagnose the error, without having to know which object was involved.

Using the CompletionCode and ReasonCode in the MQSession object is very convenient for simple error handlers.

Note:
See Threading for restrictions on the use of MQSession error codes in threaded applications.

Defined in: MQSession class

Data Type: Long

Values:

Syntax:

To get: completioncode& = MQSession.CompletionCode

ExceptionThreshold property

Read-write. Defines the level of WebSphere MQ error for which MQAX will throw an exception. Defaults to MQCC_FAILED. A value greater than MQCC_FAILED effectively prevents exception processing, leaving the programmer to perform checks on the CompletionCode and ReasonCode.

Defined in: MQSession class

Data Type: Long

Values:

Syntax:

To get: ExceptionThreshold& = MQSession.ExceptionThreshold

To set: MQSession.ExceptionThreshold = ExceptionThreshold$

ReasonCode property

Read-only. Returns the reason code set by the most recent method or property set issued against any WebSphere MQ object.

An error event handler can inspect this property to diagnose the error, without having to know which object was involved.

Using the CompletionCode and ReasonCode in the MQSession object is very convenient for simple error handlers.

Note:
See Threading for restrictions on the use of MQSession error codes in threaded applications.

Defined in: MQSession class

Data Type: Long

Values:

Syntax:
To get: reasoncode& = MQSession.ReasonCode

ReasonName property

Read-only. Returns the symbolic name of the latest reason code. For example, "MQRC_QMGR_NOT_AVAILABLE".

Note:
See Threading for restrictions on the use of MQSession error codes in threaded applications.

Defined in: MQSession class

Data Type: String

Values:

Syntax:
To get: reasonname$ = MQSession.ReasonName

AccessGetMessageOptions method

Creates a new MQGetMessageOptions object.

Defined in: MQSession class

Syntax:
gmo = MQSession.AccessGetMessageOptions()

AccessMessage method

Creates a new MQMessage object.

Defined in: MQSession class

Syntax:
msg = MQSession.AccessMessage()

AccessPutMessageOptions method

Creates a new MQPutMessageOptions object.

Defined in: MQSession class

Syntax:
pmo = MQSession.AccessPutMessageOptions()

AccessQueueManager method

Creates a new MQQueueManager object and connects it to a real queue manager by means of the WebSphere MQ client or server. As well as performing a connect, this method also performs an open for the queue manager object.

Note:
When both the WebSphere MQ server and client are installed on your system MQAX applications will always run against the server.

If successful it sets the MQQueueManager's ConnectionStatus to TRUE.

A queue manager can be connected to at most one MQQueueManager object per ActiveX instance.

If the connection to the queue manager fails, an error event is raised, and the MQSession object's ReasonCode and CompletionCode are set.

Defined in: MQSession class

Syntax:
set qm = MQSession.AccessQueueManager (Name$)

Parameter:Name$
String. Name of Queue Manager to be connected to.

ClearErrorCodes method

Resets the CompletionCode to MQCC_OK and the ReasonCode to MQRC_NONE.

Defined in: MQSession class

Syntax:
Call MQSession.ClearErrorCodes()

ReasonCodeName method

Returns the name of the reason code with the given numeric value. It is useful to give clearer indications of error conditions to users. The name is still somewhat cryptic (for example, ReasonCodeName(2059) is MQRC_Q_MGR_NOT_AVAILABLE), so where possible errors should be caught and replaced with descriptive text appropriate to the application.

Defined in: MQSession class

Syntax:
errname$ = MQSession.ReasonCodeName(reasonCode&)

Parameter:reasoncode&
Long. The reason code for which the symbolic name is required.



© IBM Corporation 2002. All Rights Reserved