MQSeries-related EGL keywords

When you work with the MQSeries-related EGL keywords like add and scan, you define an MQ record for each message queue you wish to access. The record layout is the format of the message.

The next table lists the keywords.

Keyword Purpose
add Places the content of an MQ record at the end of the specified queue.

The EGL add statement invokes as many as three MQSeries commands:

  • MQCONN connects the generated code to a queue manager and is invoked when no connection is active.

  • MQOPEN establishes a connection to a queue and is invoked when a connection is active but the queue is not open.

  • MQPUT puts the record in the queue and is always invoked unless an error occurred in an earlier MQSeries call.

After adding an MQ record, close a message queue before reading an MQ record from the same queue.

close Relinquishes access to the message queue that is associated with an MQ record.

The EGL close statement invokes the MQSeries MQCLOSE command, which also is invoked automatically when your program ends.

You should close the message queue after an add or scan if another program requires access to the queue. The close is particularly appropriate if your program runs for a long time and no longer needs access.
scan Reads the first message in a queue into a message queue record and (by default) removes the message from the queue.

The EGL scan statement invokes as many as three MQSeries commands:

  • MQCONN connects the generated code to a queue manager and is invoked when no connection is active.

  • MQOPEN establishes a connection to a queue and is invoked when a connection is active but the queue is not open.

  • MQGET removes the record from the queue and is always invoked unless an error occurred in an earlier MQSeries call.

After reading an MQ record, close the queue before adding an MQ record to the same queue.

Manager and queue specification

When you work with the MQSeries-related EGL keywords, you identify a queue in the following situations:

The name of the physical queue has the following format:

  queueManagerName:physicalQueueName

queueManagerName

Name of the queue manager; if this name is omitted, the colon is omitted, too

physicalQueueName

Name of the physical queue, as known to the specified queue manager

The first time that you issue an add or scan statement against a message queue record, a connecting queue manager must be specified, whether by default or otherwise. In the simplest case, you do not specify a connecting queue manager at all, but rely on a default value in the MQSeries configuration.

The record-specific variable record.resourceAssociation always contains at least the name of the message queue for a given MQ record.

Remote message queues

If you want to access a queue that is controlled by a remote queue manager, do the following:

  • Issue the EGL close statement to relinquish access to the queue now in use

  • Set the record-specific variable record.resourceAssociation to ensure later access of the remote queue

You set record.resourceAssociation in one of two ways, depending on how the queue-manager relationships are established in MQSeries:

  • If the connecting queue manager has a local definition of the remote queue, set record.resourceAssociation as follows:

    • Accept the same value for the connecting queue manager (either by specifying the name of the connecting queue manager or by specifying no name; in the latter case, omit the colon).

    • Specify the name of the local definition of the remote queue.

    Your next use of the add or scan statement issues an MQOPEN to establish access to the remote queue.

  • Alternatively, set record.resourceAssociation with the name of the remote queue manager, along with the name of the remote queue. The connecting queue manager does not change in this case. Your next use of the add or scan statement issues MQOPEN and uses the connection already in place.

Related concepts
Direct MQSeries calls
MQSeries support

Related reference
MQ record properties
Options records for MQ records