MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

Using MQ Feature - Default Attribute Values

By Morag Hughson posted 03/05/26 12:47 PM

  
This is part of a series of blog posts which will cover features of IBM MQ that I happen to be using this week. I spend a lot of time using MQ, and not everything counts as an MQ Little Gem, or a Quirk, but is still interesting to hear about. Read other posts in this series.

A question on a forum recently led me to describe how to set default values of MQ objects, and as a result I thought it might be a useful blog post.

Attributes of Objects

image

IBM MQ objects (queues, channels, processes etc) have (many) attributes. When you define an object you can provide a value for each attribute, but who has time for that! I don't know about you, but I can't remember ALL the attributes anyway. If you've had even a small amount of exposure to IBM MQ you'll know that it's not necessary to do that at all. You can simply define a queue like this:

DEFINE QLOCAL(MY.QUEUE)

even though there are many, many more attributes that have gone unmentioned on this command. If you then DISPLAY the object you just created, you will see all the attributes that you didn't mention still have values, and those values are the default values.

Define Like

One way to create an object without explicitly specifying all the attributes with their values, is to use a DEFINE LIKE command like this:

DEFINE QLOCAL(APP2.QUEUE) LIKE(APP1.QUEUE) MAXDEPTH(500)

This command will copy all the unmentioned attributes from the object name mentioned in the LIKE parameter. So in my example, all attributes except MAXDEPTH will come from the queue called APP1.QUEUE. Note that this is a copy - no link is maintained between the two objects. After APP2.QUEUE is created, if you change any values in APP1.QUEUE, they are not copied across to the APP2.QUEUE.

Default Objects

One special version of DEFINE LIKE is what happens if you omit to nominate a LIKE object on the command. In that case the LIKE parameter operates as if you have provided the appropriate SYSTEM.DEFAULT.* object for the object type being created. So, for example, if you type the following command:

DEFINE QLOCAL(MY.QUEUE)

it is actually exactly equivalent to this command:

DEFINE QLOCAL(MY.QUEUE) LIKE(SYSTEM.DEFAULT.LOCAL.QUEUE)

Just as with the above LIKE command, again note that this a copy - no link is maintained between the created object and the SYSTEM.DEFAULT.* object that contributed all the default values. So if you change an attribute in the SYSTEM.DEFAULT.* object it does not cause an update to previously defined objects.

Default Values

These default objects, the ones named SYSTEM.DEFAULT.* are created initially with the attribute values that IBM believes are the appropriate defaults, however, you are at liberty to change them if you prefer other values for your defaults. That's why, in older versions of MQ documentation, you'll see a repeated note above each field in the railroad diagram for commands saying "This is the default supplied with MQ, but your installation might have changed it".

image

This statement has been removed from more recent documentation (probably to make the railroad diagrams look less cluttered), but you are still allowed to change these objects as is stated as part of the description of the LIKE parameter (see here).

So, if you prefer different default values, for example DEFBIND(NOTFIXED) instead of DEFBIND(OPEN), go ahead and change the SYSTEM.DEFAULT.* object definitions.


Morag Hughson is an MQ expert. She spent 18 years in the MQ Devt organisation before taking on her current job writing MQ Technical education courses with MQGem. She also blogs for MQGem. You can connect with her here on the IBM Community or on Twitter and LinkedIn.


#Using-MQ-feature
#IBMMQ
#IBMChampion

2 comments
15 views

Permalink

Comments

03/06/26 10:19 AM

Thanks @Peter Potkay - I've made some additional notes about that in the post too as a result of your comment.

03/05/26 05:30 PM

If you do change the value of a parameter of a SYSTEM.DEFAULT object just know that the new value will only be used for new object definitions going forward. It will not cause that parameter to change on non SYSTEM.DEFAULT objects already created.