ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » How To use C examples?

Post new topic  Reply to topic
 How To use C examples? « View previous topic :: View next topic » 
Author Message
Gergo2020
PostPosted: Mon Sep 14, 2020 1:25 am    Post subject: How To use C examples? Reply with quote

Novice

Joined: 25 Jun 2020
Posts: 15

Hi all!

I would like to use c:\Program Files\IBM\MQ\Tools\c\Samples\Bin\amqsput.exe

I created a bat file, contents:
""c:\test\amqsput.exe" MQ,MQM,192.168.100.230(1414),DOTNET.SVRCONN
pause"

I got a reason code:2058
What wrong with it?

Thank You!
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Mon Sep 14, 2020 2:18 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

Why have you separated the parameters with commas? Try just using spaces.
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
Gergo2020
PostPosted: Mon Sep 14, 2020 3:35 am    Post subject: Reply with quote

Novice

Joined: 25 Jun 2020
Posts: 15

Thank you, I replaced, but same error.
Back to top
View user's profile Send private message
PaulClarke
PostPosted: Mon Sep 14, 2020 4:05 am    Post subject: Reply with quote

Grand Master

Joined: 17 Nov 2005
Posts: 1002
Location: New Zealand

Well then are you sure that the Queue Manager you are connecting to is called MQM ?
Have you looked in the MQ Client error log for any error messages ?
_________________
Paul Clarke
MQGem Software
www.mqgem.com
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Mon Sep 14, 2020 4:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

AMQSPUT will never use a client connection.
Check your mqserver environment variable and use amqsputc
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Mon Sep 14, 2020 5:04 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

Read https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q023900_.htm
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
markt
PostPosted: Mon Sep 14, 2020 5:33 am    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

Quote:
AMQSPUT will never use a client connection.


Yes it can. And has been able to for many releases. For example,
Code:

export MQ_CONNECT_TYPE=CLIENT

and then see what happens. libmqm can act as client, so there's really no need for two variants of the programs.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Mon Sep 14, 2020 9:36 am    Post subject: Re: How To use C examples? Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

Gergo2020 wrote:
Hi all!

I would like to use c:\Program Files\IBM\MQ\Tools\c\Samples\Bin\amqsput.exe

I created a bat file, contents:
""c:\test\amqsput.exe" MQ,MQM,192.168.100.230(1414),DOTNET.SVRCONN
pause"

I got a reason code:2058
What wrong with it?

Thank You!

Did you get the same results when you tested this interactively - not a batch script?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Mon Sep 14, 2020 12:59 pm    Post subject: Re: How To use C examples? Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
Location: London, ON Canada

Gergo2020 wrote:
""c:\test\amqsput.exe" MQ,MQM,192.168.100.230(1414),DOTNET.SVRCONN
pause"

Hummmm. What's that? Ok, its Monday, but I'm confused.

Here's what my batch files looks like:

Code:
@echo off
setlocal
rem
rem 1st parameter is the name of the queue
rem
set MQSERVER=DOTNET.SVRCONN/TCP/192.168.100.230(1414)
"C:\Program Files\IBM\MQ\Tools\c\Samples\Bin\amqsputc.exe" %1 MyQMgrName
endlocal


Then I call the batch file by the action and the name of the queue manager (i.e. Put2MyQMgrName).

To run it and put messages to queue 'TEST.Q1', you just do:
Code:
Put2MyQMgrName.bat TEST.Q1


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Mon Sep 14, 2020 3:26 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

markt wrote:
Quote:
AMQSPUT will never use a client connection.


Yes it can. And has been able to for many releases. For example,
Code:

export MQ_CONNECT_TYPE=CLIENT

and then see what happens. libmqm can act as client, so there's really no need for two variants of the programs.

I stand corrected... Thanks
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Gergo2020
PostPosted: Mon Sep 21, 2020 3:55 am    Post subject: Reply with quote

Novice

Joined: 25 Jun 2020
Posts: 15

Thank you all for your help. Message sent successfully. That would be my question. How can I compile my own C version? What tools are needed to add it under windows?
Thank you!
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Mon Sep 21, 2020 10:15 pm    Post subject: Re: How To use C examples? Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

Gergo2020 wrote:
Hi all!
I would like to use c:\Program Files\IBM\MQ\Tools\c\Samples\Bin\amqsput.exe
I created a bat file, contents:
""c:\test\amqsput.exe" MQ,MQM,192.168.100.230(1414),DOTNET.SVRCONN
pause"
I got a reason code:2058
What wrong with it?
Thank You!

I'm not sure where you got the idea that amqsput has this parameter format. Inspecting the source code in Tools\c\Samples\amqsput0.c would reveal the correct format.

You shouldn't copy amqsput.exe (or any of the MQ .exe or other product files) to your own directory. It would mean that the copied files would not be updated if any MQ fix packs or upgrades were installed.

On Windows, the MQ sample bin directory is in the default PATH, so you can specify amqsput.exe (or even just amqsput) in the bat file.

BTW, you can compile C programs on Windows using MS Visual Studio. There is a free Community Edition for personal use, however check if your company has a license to allow you to use Visual Studio Professional or Enterprise.
_________________
Glenn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » How To use C examples?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.