DEFINE queues
Use the MQSC DEFINE command to define a local, model, or remote queue, or a queue alias, reply-to queue alias, or a queue manager alias.
Using MQSC commands
For information on how you use MQSC commands, see Administering IBM® MQ using MQSC commands.
You can issue this command from sources
2CR
. For an explanation of the source symbols, see Sources from which you can issue MQSC and PCF commands on IBM MQ for z/OS®.
Syntax diagrams for DEFINE queues
Usage notes for DEFINE queues
- Successful completion of the command does not mean that the action completed. To check for true completion, see the DEFINE queues step in Checking that async commands for distributed networks have finished.
- For local queues
You can define a local queue with
QSGDISP(SHARED)
even though another queue manager in the queue sharing group already has a local version of the queue. However, when you try to access the locally defined queue, it fails with reason codeMQRC_OBJECT_NOT_UNIQUE
(2343). A local version of the queue with the same name can be of type QLOCAL, QREMOTE, or QALIAS and has the disposition,QSGDISP(QMGR)
.To resolve the conflict, you must delete one of the queues using the DELETE command. If the queue you want to delete contains messages, use the PURGE option or remove the messages first using the MOVE command.
For example, to delete theQSGDISP(LOCAL)
version, which contains messages, and copy those messages to theQSGDISP(SHARED)
version, then issue the following commands:MOVE QLOCAL(QUEUE.1) QSGDISP(PRIVATE) TOQLOCAL(QUEUE.1) TYPE(ADD) DELETE QLOCAL(QUEUE.1)
QSGDISP(QMGR)
- For alias queues:
DEFINE QALIAS( aliasqueue ) TARGET( otherqname ) CLUSTER( c )
advertises the queueotherqname
by the namealiasqueue
.DEFINE QALIAS( aliasqueue ) TARGET( otherqname )
allows a queue advertised by the nameotherqname
to be used on this queue manager by the namealiasqueue
.- TARGTYPE and TARGET are not cluster attributes, that is, they are not shared in a cluster environment.
- For remote queues:
DEFINE QREMOTE( rqueue ) RNAME( otherq ) RQMNAME( otherqm ) CLUSTER( cl )
advertises this queue manager as a store and forward gateway to which messages for queuerqueue
can be sent. It has no effect as a reply-to queue alias, except on the local queue manager.DEFINE QREMOTE( otherqm ) RNAME() RQMNAME( anotherqm ) XMITQ( xq ) CLUSTER
advertises this queue manager as a store and forward gateway to which messages foranotherqm
can be sent.- RQMNAME can itself be the name of a cluster queue manager within the cluster. You can map the advertised queue manager name to another name locally. The pattern is the same as with QALIAS definitions.
- It is possible for the values of RQMNAME and QREMOTE to be the same if RQMNAME is itself a cluster queue manager. If this definition is also advertised using a CLUSTER attribute, do not choose the local queue manager in the cluster workload exit. If you do so, a cyclic definition results.
- Remote queues do not have to be defined locally. The advantage of doing so is that applications can refer to the queue by a simple, locally defined name. If you do then the queue name is qualified by the name of the queue manager on which the queue resides. Using a local definition means that applications do not need to be aware of the real location of the queue.
- A remote queue definition can also be used as a mechanism for holding a queue manager alias
definition, or a reply-to queue alias definition. The name of the definition in these cases is:
- The queue manager name being used as the alias for another queue manager name (queue manager alias), or
- The queue name being used as the alias for the reply-to queue (reply-to queue alias).
- Define a reply-to queue or queue manager alias with the DEFINE QREMOTE (define a new local remote queue definition) command.
Parameter descriptions for DEFINE queues
Parameter | Local queue | Model queue | Alias queue | Remote queue |
---|---|---|---|---|
ACCTQ |
![]() |
![]() |
||
BOQNAME |
![]() |
![]() |
||
BOTHRESH |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||
CLCHNAME |
![]() |
|||
CLUSNL |
![]() |
![]() |
![]() |
|
CLUSTER |
![]() |
![]() |
![]() |
|
CLWLPRTY |
![]() |
![]() |
![]() |
|
CLWLRANK |
![]() |
![]() |
![]() |
|
CLWLUSEQ |
![]() |
|||
![]() |
![]() |
![]() |
![]() |
![]() |
CUSTOM |
![]() |
![]() |
![]() |
![]() |
DEFBIND |
![]() |
![]() |
![]() |
|
DEFPRESP |
![]() |
![]() |
![]() |
![]() |
DEFPRTY |
![]() |
![]() |
![]() |
![]() |
DEFPSIST |
![]() |
![]() |
![]() |
![]() |
DEFREADA |
![]() |
![]() |
![]() |
|
DEFSOPT |
![]() |
![]() |
||
DEFTYPE |
![]() |
|||
DESCR |
![]() |
![]() |
![]() |
![]() |
DISTL |
![]() |
![]() |
||
FORCE |
![]() |
![]() |
![]() |
|
GET |
![]() |
![]() |
![]() |
|
HARDENBO or NOHARDENBO |
![]() |
![]() |
||
IMGRCOVQ |
![]() |
![]() |
||
![]() |
![]() |
![]() |
||
INITQ |
![]() |
![]() |
||
LIKE |
![]() |
![]() |
![]() |
![]() |
MAXDEPTH |
![]() |
![]() |
||
MAXFSIZE |
![]() |
![]() |
||
MAXMSGL |
![]() |
![]() |
||
MONQ |
![]() |
![]() |
||
MSGDLVSQ |
![]() |
![]() |
||
NOREPLACE |
![]() |
![]() |
![]() |
![]() |
NPMCLASS |
![]() |
![]() |
||
PROCESS |
![]() |
![]() |
||
PROPCTL |
![]() |
![]() |
![]() |
|
PUT |
![]() |
![]() |
![]() |
![]() |
queue-name |
![]() |
![]() |
![]() |
![]() |
QDEPTHHI |
![]() |
![]() |
||
QDEPTHLO |
![]() |
![]() |
||
QDPHIEV |
![]() |
![]() |
||
QDPLOEV |
![]() |
![]() |
||
QDPMAXEV |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
QSVCIEV |
![]() |
![]() |
||
QSVCINT |
![]() |
![]() |
||
REPLACE |
![]() |
![]() |
![]() |
![]() |
RETINTVL |
![]() |
![]() |
||
RNAME |
![]() |
|||
RQMNAME |
![]() |
|||
SCOPE |
![]() |
![]() |
![]() |
|
SHARE or NOSHARE |
![]() |
![]() |
||
STATQ |
![]() |
![]() |
||
![]() |
![]() |
![]() |
||
STREAMQ |
![]() |
![]() |
||
STRMQOS |
![]() |
![]() |
||
TARGET |
![]() |
|||
TARGQ |
![]() |
|||
TARGTYPE |
![]() |
|||
TRIGDATA |
![]() |
![]() |
||
TRIGDPTH |
![]() |
![]() |
||
TRIGGER or NOTRIGGER |
![]() |
![]() |
||
TRIGMPRI |
![]() |
![]() |
||
TRIGTYPE |
![]() |
![]() |
||
USAGE |
![]() |
![]() |
||
XMITQ |
![]() |
- queue-name
- Local name of the queue, except the remote queue where it is the local definition of the remote queue.
- ACCTQ
- Specifies whether accounting data collection is to be enabled for the queue. On z/OS, the data collected is class 3 accounting data
(thread-level and queue-level accounting). In order for accounting data to be collected for this
queue, accounting data for this connection must also be enabled. Turn on accounting data collection
by setting either the ACCTQ queue manager attribute, or the options field in
the
MQCNO
structure on the MQCONNX call.- QMGR
- The collection of accounting data is based on the setting of the ACCTQ parameter on the queue manager definition.
- ON
- Accounting data collection is enabled for the queue unless the ACCTQ queue manager parameter has a value of NONE.
- OFF
- Accounting data collection is disabled for the queue.
- BOQNAME (queue-name)
- The excessive backout requeue name.
This parameter is supported only on local and model queues.
Use this parameter to set or change the back out queue name attribute of a local or model queue. Apart from allowing its value to be queried, the queue manager does nothing based on the value of this attribute. IBM MQ classes for JMS transfers a message that is backed out the maximum number of times to this queue. The maximum is specified by the BOTHRESH parameter.
- BOTHRESH(integer)
- The backout threshold.
CAPEXPRY(integer)
- The maximum time, expressed in tenths of a second, until a message put using an object handle
with this object in the resolution path, becomes eligible for expiry processing.
Important: You cannot specify an integer value for the CAPEXPRY attribute on a queue object with QSGDISP(SHARED|GROUP|COPY), which resides in a queue sharing group that contains queue managers running any version of IBM MQ for z/OS below 9.4.0. Attempting to do so results in CSQM532I and CSQM533I messages to identify which queue managers do not support CAPEXPRY, and no modification to the object.
For more information on message expiry processing, see CAPEXPRY: Limit message expiry time.
- integer
- The value must be in the range one through to 999 999 999.
- NOLIMIT
- There is no limit on the expiry time of messages put using this object. This is the default value.
CFSTRUCT(structure-name)
- Specifies the name of the coupling facility structure where you want messages stored when you use shared queues.
- CLCHNAME(channel name)
-
This parameter is supported only on transmission queues.
CLUSNL(namelist name)
- The name of the namelist that specifies a list of clusters to which the queue belongs.
CLUSTER(cluster name)
- The name of the cluster to which the queue belongs.
- CLWLPRTY(integer)
- Specifies the priority of the queue for the purposes of cluster workload distribution. This parameter is valid only for local, remote, and alias queues. The value must be in the range zero through 9 where zero is the lowest priority and 9 is the highest. For more information about this attribute, see CLWLPRTY queue attribute.
- CLWLRANK (integer)
- Specifies the rank of the queue for the purposes of cluster workload distribution. This parameter is valid only for local, remote, and alias queues. The value must be in the range zero through 9 where zero is the lowest rank and 9 is the highest. For more information about this attribute, see CLWLRANK queue attribute.
- CLWLUSEQ
- Specifies the behavior of an MQPUT operation when the target queue has a
local instance and at least one remote cluster instance. The parameter has no effect when the
MQPUT originates from a cluster channel. This parameter is valid only for local queues.
- QMGR
- The behavior is as specified by the CLWLUSEQ parameter of the queue manager definition.
- ANY
- The queue manager is to treat the local queue as another instance of the cluster queue for the purposes of workload distribution.
- LOCAL
- The local queue is the only target of the MQPUT operation.
CMDSCOPE
- This parameter applies to z/OS only. It specifies where the command is run when the queue manager is a member of a queue sharing group.
- CUSTOM(string)
- The custom attribute for new features.
- DEFBIND
- Specifies the binding to be used when the application specifies
MQOO_BIND_AS_Q_DEF
on the MQOPEN call, and the queue is a cluster queue.- OPEN
- The queue handle is bound to a specific instance of the cluster queue when the queue is opened.
- NOTFIXED
- The queue handle is not bound to any instance of the cluster queue. The queue manager selects a specific queue instance when the message is put using MQPUT. It changes that selection later, if the need arises.
- GROUP
- Allows an application to request that a group of messages is allocated to the same destination instance.
- DEFPRESP
- Specifies the behavior to be used by applications when the put response type, within the
MQPMO options, is set to
MQPMO_RESPONSE_AS_Q_DEF
.- SYNC
- Put operations to the queue specifying
MQPMO_RESPONSE_AS_Q_DEF
are issued as ifMQPMO_SYNC_RESPONSE
is specified instead. - ASYNC
- Put operations to the queue specifying
MQPMO_RESPONSE_AS_Q_DEF
are issued as ifMQPMO_ASYNC_RESPONSE
is specified instead; see MQPMO options (MQLONG).
- DEFPRTY(integer)
- The default priority of messages put on the queue. The value must be in the range 0 - 9. Zero is the lowest priority, through to the MAXPRTY queue manager parameter. The default value of MAXPRTY is 9.
- DEFPSIST
- Specifies the message persistence to be used when applications specify the
MQPER_PERSISTENCE_AS_Q_DEF
option.- NO
- Messages on this queue are lost across a restart of the queue manager.
- YES
- Messages on this queue survive a restart of the queue manager.
- DEFREADA
- Specifies the default read ahead behavior for non-persistent messages delivered to the client.
Enabling read ahead can improve the performance of client applications consuming non-persistent messages.
- NO
- Non-persistent messages are not read ahead unless the client application is configured to request read ahead.
- YES
- Non-persistent messages are sent to the client before an application requests them. Non-persistent messages can be lost if the client ends abnormally or if the client does not delete all the messages it is sent.
- DISABLED
- Read ahead of non-persistent messages in not enabled for this queue. Messages are not sent ahead to the client regardless of whether read ahead is requested by the client application.
- DEFSOPT
- The default share option for applications opening this queue for input:
- EXCL
- The open request is for exclusive input from the queue.
- SHARED
- The open request is for shared input from the queue.
- DEFTYPE
- Queue definition type.
- DESCR(string)
- Plain-text comment. It provides descriptive information about the object when an operator issues the DISPLAY QUEUE command.
DISTL
- Sets whether distribution lists are supported by the partner queue manager.
- YES
- Distribution lists are supported by the partner queue manager.
- NO
- Distribution lists are not supported by the partner queue manager.
Note: You do not normally change this parameter, because it is set by the MCA. However you can set this parameter when defining a transmission queue if the distribution list capability of the destination queue manager is known. - FORCE
- This parameter applies only to the ALTER command on alias, local and remote queues.
- GET
- Specifies whether applications are to be permitted to get messages from this queue:
- ENABLED
- Messages can be retrieved from the queue, by suitably authorized applications.
- DISABLED
- Applications cannot retrieve messages from the queue.
- HARDENBO and NOHARDENBO
- Specifies whether the count of the number of times that a message was backed out is hardened. When the count is hardened, the value of the BackoutCount field of the message descriptor is written to the log before the message is returned by an MQGET operation. Writing the value to the log ensures that the value is accurate across restarts of the queue manger.
IMGRCOVQ
- Specifies whether a local or permanent dynamic queue object is recoverable from a media image,
if linear logging is being used. Possible values are:
- YES
- These queue objects are recoverable.
- NO
- The rcdmqimg (record media image) andrcrmqobj (re-create object) commands are not permitted for these objects, and automatic media images, if enabled, are not written for these objects.
- QMGR
- If you specify QMGR, and the IMGRCOVQ attribute for the queue manager specifies YES, these queue objects are recoverable.
INDXTYPE
- The type of index maintained by the queue manager to expedite MQGET operations on the queue. For shared queues, the type of index determines the type of MQGET operations that can be used.
- INITQ(string)
- The local name of the initiation queue on this queue manager, to which trigger messages relating to this queue are written. See Rules for naming IBM MQ objects.
- LIKE(qtype-name)
- The name of a queue, with parameters that are used to model this definition.
MAXDEPTH(integer)
- The maximum number of messages allowed on the queue.
MAXFSIZE
- The maximum size, in megabytes, that a queue file can grow to. It is possible for a queue file to exceed this size if you have configured the value to be lower than the current queue file size.
- MAXMSGL(integer)
- The maximum length (in bytes) of messages on this queue.
- MONQ
- Controls the collection of online monitoring data for queues.
- MSGDLVSQ
- Message delivery sequence.
NPMCLASS
- The level of reliability to be assigned to non-persistent messages that are put to the queue:
- NORMAL
- Non-persistent messages are lost after a failure, or queue manager shutdown. These messages are discarded on a queue manager restart.
- HIGH
- The queue manager attempts to retain non-persistent messages on this queue over a queue manager restart or switch over.
- PROCESS(string)
- The local name of the IBM MQ process.
- PROPCTL
- Property control attribute. The attribute is optional. It is applicable to local, alias, and
model queues. Note: If your application is opening an alias queue you must set this value on both the alias and target queues.
- PUT
- Specifies whether messages can be put on the queue.
- ENABLED
- Messages can be added to the queue (by suitably authorized applications).
- DISABLED
- Messages cannot be added to the queue.
- QDEPTHHI(integer)
- The threshold against which the queue depth is compared to generate a Queue Depth High event.
- QDEPTHLO(integer)
- The threshold against which the queue depth is compared to generate a Queue Depth Low event.
- QDPHIEV
- Controls whether Queue Depth High events are generated.
- QDPLOEV
- Controls whether Queue Depth Low events are generated.
- QDPMAXEV
- Controls whether Queue Full events are generated.
QSGDISP
- This parameter applies to z/OS only.
Specifies the disposition of the object within the group.
Table 5. Object dispositions for QSGDISP options QSGDISP DEFINE COPY The object is defined on the page set of the queue manager that executes the command. It uses the QSGDISP(GROUP) object of the same name as the LIKE object.
For example, if you issue the following command,
the queue manager searches the shared configuration repository for aDEFINE QUEUE(q_name) REPLACE QSGDISP(COPY)
QUEUE
definition called q_name. If a matchingQUEUE
definition is found, the queue manager creates a local copy of this definition on the queue manager page set.For local queues, messages are stored on the page sets of each queue manager and are available only through that queue manager.
GROUP The object definition resides in the shared configuration repository. QSGDISP(GROUP) is allowed only if the queue manager is in a queue sharing group.
If the DEFINE for the QSGDISP(GROUP) object is successful, the
DEFINE QUEUE(q_name) REPLACE QSGDISP(COPY)
command is generated and sent to all active queue managers in the queue sharing group to make or refresh local copies on page set zero.The DEFINE for the group object takes effect regardless of whether the generated command with QSGDISP(COPY) fails.
PRIVATE Not permitted. QMGR The object is defined on the page set of the queue manager that executes the command.
SHARED This option applies only to local queues. The object is defined in the shared repository. Messages are stored in the coupling facility and are available to any queue manager in the queue sharing group. You can specify SHARED only if: - CFSTRUCT is not blank
- INDXTYPE is not MSGTOKEN
- The queue is not:
-
SYSTEM.CHANNEL.INITQ
-
SYSTEM.COMMAND.INPUT
-
- QSVCIEV
- Controls whether Service Interval High or Service Interval OK events are generated.
- QSVCINT(integer)
- The service interval used for comparison to generate Service Interval High and Service Interval OK events.
- REPLACE & NOREPLACE
- This option controls whether any existing definition is to be replaced with this one.
Note: On IBM MQ for z/OS, an existing definition is replaced only if it is of the same disposition. Any object with a different disposition is not changed.
- REPLACE
- If the object does exist, the effect is like issuing the ALTER command
without the FORCE parameter and with all the other parameters specified. In
particular, note that any messages that are on the existing queue are retained.
There is a difference between the ALTER command without the FORCE parameter, and the DEFINE command with the REPLACE parameter. The difference is that ALTER does not change unspecified parameters, but DEFINE with REPLACE sets all the parameters. If you use REPLACE, unspecified parameters are taken either from the object named on the LIKE parameter, or from the default definition, and the parameters of the object being replaced, if one exists, are ignored.
The command fails if both of the following statements are true:- The command sets parameters that would require the use of the FORCE parameter if you were using the ALTER command
- The object is open
The ALTER command with the FORCE parameter succeeds in this situation.
If SCOPE(CELL) is specified on AIX, Linux, and Windows, and there is already a queue with the same name in the cell directory, the command fails, even if REPLACE is specified.
- NOREPLACE
- The definition must not replace any existing definition of the object.
- RETINTVL(integer)
- The number of hours from when the queue was defined, after which the queue is no longer needed. The value must be in the range 0 - 999,999,999.
- RNAME(string)
- Name of remote queue. This parameter is the local name of the queue as defined on the queue manager specified by RQMNAME.
- RQMNAME(string)
- The name of the remote queue manager on which the queue RNAME is defined.
SCOPE
- Specifies the scope of the queue definition.
- SHARE and NOSHARE
- Specifies whether multiple applications can get messages from this queue.
- STATQ
- Specifies whether statistics data collection is enabled:
- QMGR
- Statistics data collection is based on the setting of the STATQ parameter of the queue manager.
- ON
- If the value of the STATQ parameter of the queue manager is not NONE, statistics data collection for the queue is enabled.
- OFF
- Statistics data collection for the queue is disabled.
STGCLASS(string)
- The name of the storage class.
- STREAMQ
- The name of a secondary queue where a copy of each message is put.
- STRMQOS
- The quality of service to use when delivering messages to the streaming queue.
- TARGET(string)
- The name of the queue or topic object being aliased; See Rules for naming IBM MQ objects. The object can be a queue or a topic as defined by TARGTYPE. The maximum length is 48 characters.
- TARGTYPE(string)
- The type of object to which the alias resolves.
- QUEUE (default)
- The alias resolves to a queue.
- TOPIC
- The alias resolves to a topic.
- TRIGDATA(string)
- The data that is inserted in the trigger message. The maximum length of the string is 64 bytes.
- TRIGDPTH(integer)
- The number of messages that have to be on the queue before a trigger message is written, if
TRIGTYPE is DEPTH. The value must be in the range 1 -
999,999,999. The default value is
1
. - TRIGGER and NOTRIGGER
- Specifies whether trigger messages are written to the initiation queue, named by the
INITQ parameter, to trigger the application, named by the
PROCESS parameter:
- TRIGGER
- Triggering is active, and trigger messages are written to the initiation queue.
- NOTRIGGER
- Triggering is not active, and trigger messages are not written to the initiation queue. This is
the default value.
This parameter is supported only on local and model queues.
- TRIGMPRI(integer)
- The message priority number that triggers this queue. The value must be in the range zero through to the MAXPRTY queue manager parameter; see DISPLAY QMGR (display queue manager settings) for details. The default value is zero.
- TRIGTYPE
- Specifies whether and under what conditions a trigger message is written to the initiation queue. The initiation queue is named by the INITQ parameter.
- USAGE
- Queue usage.
- XMITQ(string)
- The name of the transmission queue to be used for forwarding messages to the remote queue. XMITQ is used with either remote queue or queue manager alias definitions.