|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to Write a WebSphere MQ Client Program using C Language |
« View previous topic :: View next topic » |
Author |
Message
|
Lothar1 |
Posted: Tue Nov 26, 2002 1:51 am Post subject: How to Write a WebSphere MQ Client Program using C Language |
|
|
Novice
Joined: 25 Mar 2002 Posts: 13 Location: HK
|
Hi Friends,
I have to write a program in C for WebSphere MQ Client, i dont want to use the amqsputc program supplied for the WMQ Client, i wanted to write of my own, Can anyone help me the steps for writting and complying once i have written the code, I will aprrocaite if anyone can help me to understand the prerequists for writting the WebSphere MQ Client Program in C language.
Thanks in Advance..
Lothar. |
|
Back to top |
|
 |
clindsey |
Posted: Tue Nov 26, 2002 12:17 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
This is a fairly broad question. I would assume you are talking about a basic messaging application.
Have you looked at the source code for amqsputc?
It is in <mqtop>\tools\c\samples as amqsput0.c
This source file produces 2 executables, amqsput and amqsputc. The only difference is that amqsput is linked with
MQ server library and amqsputc is linked with the client library. There are many other good samples in this same
directory that should how to use many of the MQ apis.
The basic mqi calls start with an MQCONN or MQCONNX to connect to a queue manager and end with an MQDISC.
In betweem, you use MQOPEN, MQGET, MQPUT to get access to queues, get, and put messages.
Beyond this, you can use the PCF interface to manager MQ objects or create channel exits for security, conversion, etc.
If you are looking for suggestions beyond basic messaging,
you should ask again an be more specific.
The other point you need to know about is linking your app.
You did not mention a specific O/S. You can refer to the Programming Guide to get info on O/S specific libs. For example, if this is NT/2000 link with mqm.lib for server programs and mqic32.lib for client programs.
Hope this helps,
Charlie |
|
Back to top |
|
 |
Lothar1 |
Posted: Tue Nov 26, 2002 7:14 pm Post subject: |
|
|
Novice
Joined: 25 Mar 2002 Posts: 13 Location: HK
|
Hi Charlie,
Thanks a lot for the reply and help..Can You please do let me know if i rename amqsput.c into amqsput01C.c for MQ Client
then how can i complie this program for the MQ Client and what are the other steps i need to follow to make this program
as MQ Client program like you said MQ client libary.Since there is amqsputc.exe but dont have the sample code.
I will be more delighted if you please do let me know step, My Machine is Winds 2000 having client installed.
Thanks a Lot Charlie
Lothar |
|
Back to top |
|
 |
Bill57 |
Posted: Wed Nov 27, 2002 9:36 am Post subject: |
|
|
Apprentice
Joined: 26 Jul 2002 Posts: 35 Location: Atlanta, GA
|
To some extent it depends on what you want the client to do. If it is just a simple "put / get" then you only have to include the cmqc.h header file, and at compile time link the code with the mqic32.lib library to make it a client.
It's true, the IBM sample code is not very robust, but if your just starting out coding MQ apps, it's not a bad place to start. The comments in the source will help with what needs to be declaired and to some extent why.
What platform are you compiling on? UNIX? Windows?
Hope this helps some
Bill _________________ Bill Anderson
MQSeries Developer |
|
Back to top |
|
 |
clindsey |
Posted: Wed Nov 27, 2002 12:03 pm Post subject: |
|
|
Knight
Joined: 12 Jul 2002 Posts: 586 Location: Dallas, Tx
|
The source for amqsputc.exe is amqsput0.c. (Same source is for both amqsput and amqsputc... just linked with different lib and given different names.)
With MS Visual C++, you can build it from a command line with:
cl amqsput0.c mqic32.lib /oamqsputc.exe
To build the server version, use:
cl amqsput0.c mqm.lib /oamqsput.exe
If you do not include the /o, the output name will default to amqsput0.exe
Charlie |
|
Back to top |
|
 |
VivekMeshram |
Posted: Wed Nov 27, 2002 4:30 pm Post subject: |
|
|
 Voyager
Joined: 25 Mar 2002 Posts: 83
|
Hi Lothar,
Yes you can copy amqsputc0.c let say amqsputc00.c for the MQ Client Program, then Please follow the following Steps.
1. Create a SVRCONN channel at the MQ Server Side (ie for Queue Manager).
2. Compile amqsputc00.c as follows which is to liking to mqic32.lib for the MQ Client Libary.
c:> icc -i c:\>MQSeries\Tools\Lib\mqic32.lib amqsputc00.c (For MQ Client)
3. put the message
Hope this will work out in your case...If you have facing any problem with these things please get back to me. _________________ Thanks
Vivek S Meshram.
·IBM Certified Specialist – IBM WebSphere MQ v5.3 / v5.2 |
|
Back to top |
|
 |
Lothar1 |
Posted: Sat Nov 30, 2002 2:12 am Post subject: |
|
|
Novice
Joined: 25 Mar 2002 Posts: 13 Location: HK
|
Hello vivek,
Thanks a lot for the steps , its worked out smoothly with the steps you have told me..once again thanks a lot ...can i write a mail on your personal email id which i can see on your profile, if i have any other doubts....
Thanks guys..
Lothar. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|