Search This Blog

Tuesday, May 1, 2012

MQ CCDT files with C++


A client channel definition table (CCDT) file contains the details of all the client-connection channels defined at the WebSphere MQ Server. It is a binary file with the name amqclchl.tab and it is created automatically by the WebSphere MQ system when you create one or more client connection channels. You can find this file on the server at this location:

On Windows
\mqm\qmgrs\\@ipcc

On UNIX systems
/var/mqm/qmgrs//@ipcc

How to work with CCDT file in C++ MQ client ?
the easiest way to test your CCDT file is via the amqsputc program that shipped with MQ installation.
set the next env params ( the mqsslkeyr is for ssl key , i used in this sample , its optional, if no ssl required):
the paths is where to find your AMQCLCHL.TAB  files ...
more about Using WebSphere MQ environment variables

(make sure the MQSERVER env param is not set)


set mqchllib=C:\Program Files\IBM\WebSphere MQ\Qmgrs\MYQM\ssl\MQCLIENT
set mqchltab=AMQCLCHL.TAB
set mqsslkeyr=C:\Program Files\IBM\WebSphere MQ\Qmgrs\ MYQM\ssl\MQCLIENT\key

run the next command
amqsputc   MY.Q


if all configured well you should connect to QM and put messages into yours 


How to use CCDT  with C++  ?
the idea is simple , make sure you set the env param before connecting to the QM.
avoid setting the queue name and the channel name , or any connection details.
only the Queue name is important.

putenv("mqchllib=C:\Program Files\IBM\WebSphere MQ\Qmgrs\ MYQM\ssl\MQCLIENT");
putenv(" mqchltab=AMQCLCHL.TAB");
putenv("mqsslkeyr=C:\Program Files\IBM\WebSphere MQ\Qmgrs\ MYQM\ssl\MQCLIENT\key");

ImqQueueManager mgr;
mgr.connect();

ImqQueue q1;
q1.setName("MY.Q.NAME");

q1.setConnectionReference( m_QMgr );
q1.setOpenOptions(m_lOpenQueueInFlags);
q1.open();


Enjoy
Yaniv Tzanany

1 comment:

Anonymous said...

This code transcript is exactly what i wanted.being a non programmer, i am bit unaware of the semantic.. can u post a complete c++ class file. Is this possible in java?