EGL Reference Guide for iSeries

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, you must 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, you must 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, you must do the following:

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


Related concepts
Direct MQSeries calls
MQSeries support


Related reference
MQ record properties
Options records for MQ records


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]