Creating a CCDT for any version

You may have read an earlier post where we described being able to determine what version of CCDT you had in your hand.

CCDT Version

How often have you had a CCDT file in your hand and wondered what version it was and whether you can give it to some of your known back-level client machines to use.

MQSCX can help you determine this. Open up your CCDT using the mqscx -n mode and then you can quite simply display the version number of all your client channels therein.

What you may not have realised from that post however, was that not only can MQSCX help to investigate what version number your CCDT is made for, it can also make a CCDT for the correct version as well. If you have back-level clients, it can be a real pain having to keep a queue manager of the same level around just to be able to create a CCDT that it will understand. Well, you can ditch that queue manager and use MQSCX instead. It’s really easy to do as well.

To use MQSCX to work with a CCDT, you need to use the -n parameter. This will then look for the CCDT file in the location specified by the MQCHLLIB and MQCHLTAB environment variables unless you provide the -t parameter to give it a specific file name. If one doesn’t exist, it will make a new one for you, and if one does exist it will read it and allow you to update it. In order to control the version of CCDT you are creating, you should additionally use the -V parameter which allows you to specify the version the CCDT file should be written as.

Here’s an example, run the MQSCX program like this:

mqscx -n -t C:\MQGem\CCDT\MQGEM.TAB -V7.0

And then you can use it to make DISPLAY, ALTER and DELETE commands.

MQSCX Extended MQSC Program – Version 8.0.0

CCDT commands directed to file ‘C:\MQGem\CCDT\MQGEM.TAB’

Licenced to Paul Clarke

Licence Location: Head Office

[12:02:10] DISPLAY CHANNEL(*) CONNAME VERSION

_________________________________________________

CHANNEL(MQG1.SVRCONN) CHLTYPE(CLNTCONN)

CONNAME(win12.mqgem.com(1602)) VERSION(8.0)

_________________________________________________

CHANNEL(MQG2.SVRCONN) CHLTYPE(CLNTCONN)

CONNAME(aix5.mqgem.com(4231)) VERSION(8.0)

_________________________________________________

CHANNEL(MQG3.SVRCONN) CHLTYPE(CLNTCONN)

CONNAME(mvs1.mqgem.com(1255)) VERSION(8.0)

_________________________________________________

Total display responses – Received:3

>

As you can see, at the moment all the channels in this CCDT are at V8.0 which means my V7.0 client won’t be able to read them. I need to make a change to each record to ensure MQSCX will write it out at version V7.0 as I have indicated on my start command. Helpfully, I can do that in one single command:-

ALTER CHANNEL(*)

This makes no actual change to the attributes of the channel definition, but does ‘touch’ each record to ensure that it gets the new version. Displaying the records again as above will show that the version number for each channel mentioned by the ALTER command (in this example all of them), now indicates it is at version V7.0, just what my back-level client application needs.

Exiting MQSCX and re-running it will show you that this earlier version of the CCDT has indeed been hardened.

Note that if you had been using some attributes introduced in later versions than V7.0, this information would be lost when altering the channel definition to be an earlier version.


If you’d like to try out MQSCX, please email support@mqgem.com to request a trial licence.

Visibility of QMgr’s Server in MO71

The MO71 product allows you to administer queue managers that are both local and remote to the machine where it runs. When remote, you can connect in via mode, or in client mode. Since WebSphere MQ V7.1 was released, queue managers could be configured as multi-instance, and client connections could be made with a comma-separated list of hostnames (and ports) in the CONNAME field.

This comma-separated CONNAME has been available to use in MO71’s direct client configuration since that time. You can also make MO71 client connections using a CCDT if you prefer.

When using a comma-separated list of hostnames, it is useful to know which of the hostnames you actually managed to connect to, perhaps so you can have a quick view of which machine is currently the primary in order to log into the machine directly, or because you have a preferential Primary and Backup machine and you need to know when the Backup is in use.

MO71 Client configuration

MO71 Client configuration for Multi-instance queue manager

MO71 showing multi-instance annotation

MO71 showing multi-instance annotation

When configuring the list of hostnames in MO71’s client connection dialog, you can now optionally add a string to be displayed when that hostname is the one successfully connected to. You don’t have to include the string for each hostname. You may prefer to only have the annotation on the screen when the Backup server is in use and so would omit the string for the primary hostname and add it to the secondary hostname.

Here are a few examples

Connection Name : win9.mqgem.com(1701) “Primary”, win12.mqgem.com(1701) “Secondary”
Connection Name : win9.mqgem.com(1701), win12.mqgem.com(1701) “**Backup**”

Note that you must configure the client channel directly for this annotation to work. You cannot, for example, use a channel defined in the Client Channel Definition Table (CCDT).


Comma-separated CONNAME has been in MO71 for a while, but the recent 9.0.2 release added the ability to see which of the instances is in use.

Be sure of your CCDT Version

CCDT VersionWe all know that you can’t use a CCDT file with a client that is older than the CCDT version. For example, a version 6 client can’t understand what the channel definitions in a V8 produced CCDT mean.

How often have you had a CCDT file in your hand and wondered what version it was and whether you can give it to some of your known back-level client machines to use.

MQSCX can help you determine this. Open up your CCDT using the mqscx -n mode and then you can quite simply display the version number of all your client channels therein.

DISPLAY CHANNEL(*) VERSION

CHANNEL(MQGEM.SVRCONN)            CHLTYPE(CLNTCONN)   VERSION(8.0)
CHANNEL(MQGEM.SVRCONN.SSL)        CHLTYPE(CLNTCONN)   VERSION(9.0)
CHANNEL(MQGEM.SVRCONN.ADMIN)      CHLTYPE(CLNTCONN)   VERSION(7.0)

Alternatively, you might like to write a little script that could iterate through all the channels in the table and tell you the minimum and maximum versions in use within that CCDT.

if (_ccdtmode)
  @minVer = 999999999
  @maxVer = 0
  foreach (DISPLAY CHANNEL(*) VERSION)
    if (VERSION < @minVer)
      @minVer = VERSION
    endif
    if (VERSION > @maxVer)
      @maxVer = VERSION
    endif
  endfor
  if (_numEach)
    print "Channel version in",_ccdt
    print "Minimum:",@minVer,"Maximum:",@maxVer
  else
    print "No channels found in",_ccdt
  endif
else
  print "Run this script with MQSCX in CCDT mode"
endif

Running this against a multi-version CCDT might produce output such as:-

Channel version in C:\MQGem\CCDT\MQGEM101.TAB
Minimum: 7.00 Maximum: 9.00

foreachThis type of CCDT analysis is possible due to the recent addition of the foreach construct to the CCDT processing in MQSCX.

If you are a current MQSCX licence holder, you can simply download the new version of MQSCX and start using it. If you’re not a current licence holder, and you’d like to try out MQSCX, please email support@mqgem.com to request a trial licence.

Scripts using foreach on the CCDT

foreachThere are different types of users who use MQSCX. Some like the interactive experience, with tab auto-complete of commands, keywords and objects names. Others like the ability to create and edit CCDT files suitable for any required version of IBM MQ. Others again like the powerful control language which makes writing scripts to interrogate your queue manager a breeze.

Freaking awesome, Paul! I wrote several reporting scripts for a customer a couple of months back. They declined to purchase MQSCX so I was forced to do much of the logic in the script, giving me I have a good basis for comparison of both approaches. The differential in lines of code, complexity and amount of additional billable time I spent would have paid for a site license for several years. The ROI is now more than doubled, possibly even 5x what it was.

User comment on MQSCX – see more at What our customers say

Sometimes those different use cases come together. The control language has a for loop concept where you can easily iterate over all the queue manager objects that are returned by the command server as the answer to an MQSC command, with a script something like this:-

@total = 0
foreach(DISPLAY QLOCAL(*) WHERE(CURDEPTH GT 0))
  @total = @total + CURDEPTH
endfor
print 'Total CURDEPTH =',@total

You can also write scripts that operate, not on queue manager objects, but on the contents of a CCDT file.

With the latest version of MQSCX, you can use the foreach construct on the items in your CCDT file in just same way as above. Here’s a small example:-

@ssl = 0;
foreach(DISPLAY CHANNEL(*) SSLCIPH)
  if (SSLCIPH)
    @ssl = @ssl + 1
  endif
endfor
print 'Found',@ssl,'SSL Channels out of',_numEach

Now with MQSCX V9.0.0 you can use the powerful control language to analyse and manipulate your CCDT files. Another example of using the foreach construct on a CCDT file can be see in Be sure of your CCDT Version


If you are a current MQSCX licence holder, you can simply download the new version of MQSCX and start using it. If you’re not a current licence holder, and you’d like to try out MQSCX, please email support@mqgem.com to request a trial licence.

Using the CCDT URL

MQGem recently delivered new versions of MO71 and MQSCX that support the new IBM MQ V9 release. As well as support for the new command level, they support other new IBM MQ V9 features. One such feature is the ability to have your Client Channel Definition Table (CCDT) hosted somewhere centralised, such as on an FTP server or web server. Prior to IBM MQ V9, this was only available to Java clients due to the fact that the language gave you the capability whenever you needed to specify a file name URI. Now in IBM MQ V9, ‘C’ clients (and unmanaged .NET clients) also have this feature.

Jon Rumsey has a great write-up of this feature on the MQDev Blog, MQ V9 Client Channel Table Enhancements – URL retrieval.

MO71

You can either set the MQCCDTURL environment variable and the whole MO71 application will take note of it, or you can set it individually for specific locations by providing the CCDT URL in the location dialog. Open the Location, ensure the Client checkbox is ticked which enables two things, the Configure button – which is for defining your channel definition manually through the MQCNO, and the CCDT URL entry field, which is where you can put the URL of your hosted CCDT file. You don’t need both of course, and MQ defines a precedence order of which is used if you do specify both.

MO71 Location Dialog showing CCDT URL field in use

Specify your CCDT URL in the MO71 Location Dialog.
Please note, the URL shown is for demonstration purposes only. There is no CCDT at the shown URL!

MQSCX

As with MO71, you can either set the MQCCDTURL environment variable and the whole MQSCX application will take note of it, or you can set it individually for specific locations by providing the ccdturl() on the =conn command.

MQSCX Extended MQSC Program – Version 9.0.0

Licenced to Paul Clarke

Licence Location: Head Quarters

> =conn qm(MQ900) client ccdturl(http://www.mqgem.com/MQGEM.TAB)

MQSCX Extended MQSC Program – Version 9.0.0

Licenced to Paul Clarke

Licence Location: Head Quarters

[14:05:31] =conn qm(MQ900) client ccdturl(http://www.mqgem.com/MQ

Connected to ‘MQ900’

MQ900>


If this feature interests you and you’d like to try it out for yourself on either of these products, and you are not currently a licence holder, you may email support@mqgem.com to request a trial licence.

MaxChannels vs DIS QMSTATUS CONNS

I got asked this question on twitter the other day, so I thought it would make an interesting blog post.

Let’s look at each piece of the question.

DISPLAY QMSTATUS CONNS

You can use the DISPLAY QMSTATUS command to see how many connections there are currently made into the queue manager. This is a count of the number of applications (or some queue manager processes too) that have made an MQCONN(X) to the queue manager. It is also the same number of responses you should see returned by DISPLAY CONN(*) – if you don’t want to count them, find an MQ admin tool that counts them for you. These connections might be local or client connections – both contribute to the total.

To see the local ones use command:-

DISPLAY CONN(*) ALL WHERE(CHANNEL EQ ' ')

To see the remote ones use command:-

DISPLAY CONN(*) ALL WHERE(CHANNEL NE ' ')

Client Connections and MaxChannels

So having ruled out the local connections what should you think if the number of connections coming in over a channel is more than MaxChannels? As the question asks, “Shouldn’t that be failing?”

The other thing to remember here is that, since MQ V7, one SVRCONN channel can relay several client MQCONNs over to the queue manager.

To see this take a look at the DISPLAY CHSTATUS command. There is a status attribute CURSHCNV that shows the number currently being shared over that one SVRCONN instance.

To see the number of running channels, use the command:-

DISPLAY CHSTATUS(*) CURSHCNV

The number of responses will show you how many running channel instances there are – which is the number to compare against MaxChannels. If you add up the total of all the numbers shown in CURSHCNV, this total will be less than (or equal to) the above number of channel based connections shown when you used the DISPLAY CONN command. Both queue manager channels and client channels contribute to that total.

HINT: If you want an easy way to total up all the numbers shown in CURSHCNV, try out MQSCX with this single line:-

@total=0;foreach(DISPLAY CHSTATUS(*) CURSHCNV);@total=@total+CURSHCNV;endfor;print @total

Or you could make a little import file to print out all the various numbers:-

=echo cmds(NO)
=echo resp(NO)
print 'Show all the connections into queue manager',_connqmgr
print _sep

DISPLAY QMSTATUS CONNS
print 'Total connections ',CONNS

DISPLAY CONN(*) ALL WHERE(CHANNEL EQ ' ')
print 'Local connections ',_matches

DISPLAY CONN(*) ALL WHERE(CHANNEL NE ' ')
print 'Remote connections',_matches

@total = 0
@svrcn = 0
foreach(DISPLAY CHSTATUS(*) CURSHCNV CHLTYPE)
  if (CHLTYPE = "SVRCONN")
    @svrcn = @svrcn + 1
  endif
  @total = @total + CURSHCNV
endfor
print 'Total Channel instances ',_matches
print 'QMgr Channel instances  ',_matches - @svrcn
print 'Client Channel instances',@svrcn
print 'Client connections',@total
=echo cmds(YES)
=echo resp(YES)

UPDATE: This script evolved further with the release of MQSCX V9.0.0 and the use of functions – see more in MQSCX Functions.


IBM Certified SpecialistIBM Champion 2016 Middleware

Morag Hughson
IBM Champion 2016 – Middleware
IBM Certified System Administrator – MQ V8.0
Find her on: LinkedIn: http://uk.linkedin.com/in/moraghughson Twitter: https://twitter.com/MoragHughson SlideShare: http://www.slideshare.net/moraghughson developerWorks: https://www.ibm.com/developerworks/community/profiles/html/profileView.do?userid=110000EQPN

MQCCDTURL and mqclient.ini

During the process of writing my June IBM MQ Little Gem post over on IMWUC, I learned a bit more about the CCDT URL feature in IBM MQ V9 and how it works when you use an mqclient.ini file.

Jon Rumsey has a great write-up of this feature on the MQDev Blog, MQ V9 Client Channel Table Enhancements – URL retrieval, where he indicates that the equivalent to the MQCCDTURL environment variable is to use the ChannelDefinitionDirectory attribute in the Channels stanza of mqclient.ini.

mqclient.ini file for IBM V9My new blog post has a table of all the client environment variables and their equivalents in the mqclient.ini file (an update to a post I wrote in 2014). I noticed that the attribute that Jon refers to, ChannelDefinitionDirectory, is already in use as the equivalent to the MQCHLLIB environment variable.

I know that the MQCHLLIB environment variable only specifies the path to the CCDT, whereas the MQCCDTURL environment variable specifies the whole path and file name. So I wondered whether ChannelDefinitionDirectory was really the direct equivalent.

I had previously been using the following environment variable:-

set MQCCDTURL=http://www.mqgem.com/MQGEM.TAB

so I tried out an mqclient.ini file with the following contents as a direct equivalent:-

CHANNELS:
  ChannelDefinitionDirectory=http://www.mqgem.com/MQGEM.TAB

and was rewarded by the following error in my AMQERR01.LOG:-

AMQ9795: The client channel definition could not be retrieved from
its URL, error code (16).

EXPLANATION:
The client channel definition location was specified as URL
'http://www.mqgem.com/MQGEM.TAB/AMQCLCHL.TAB', however the file could
not be retrieved from this location. 

The error returned was (16) 'HTTP response code said error'. The
protocol specific response code was (404).
ACTION:
Ensure that the URL is reachable and if necessary correct the details
provided.

404 is the standard HTTP “not found” response code, and it is not a surprise that it couldn’t find the file since it has concatenated the default AMQCLCHL.TAB file name on the end of what I provided. So it would seem that you need to use both ChannelDefinitionDirectory and ChannelDefinitionFile in the mqclient.ini file to get the equivalent behaviour to the MQCCDTURL environment variable.

With an mqclient.ini file with the following contents:-

CHANNELS:
  ChannelDefinitionDirectory=http://www.mqgem.com
  ChannelDefinitionFile=MQGEM.TAB

I was able to successfully connect.


IBM Certified SpecialistIBM Champion 2016 Middleware

Morag Hughson
IBM Champion 2016 – Middleware
IBM Certified System Administrator – MQ V8.0
Find her on: LinkedIn: http://uk.linkedin.com/in/moraghughson Twitter: https://twitter.com/MoragHughson SlideShare: http://www.slideshare.net/moraghughson developerWorks: https://www.ibm.com/developerworks/community/profiles/html/profileView.do?userid=110000EQPN