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 » Sample MS VC/C++ using PCF

Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next
 Sample MS VC/C++ using PCF « View previous topic :: View next topic » 
Author Message
jefflowrey
PostPosted: Tue Jun 14, 2005 4:59 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

klamerus wrote:
What we don't know how to do is use this command and we're looking for a sample with the associated code that makes a working sample.


That's why I included Roger's quote, which agreed with me that you need to modify the command parameter you specify to the mqExecute function to specify the proper MQAI version of "Reset Queue Statistics", and then modify the code that handles the response to extract the proper values from the bag returned that indicate the data points you want to get.

You've got code that use the MQAI to execute one command, and to extract the necessary values from the response. It is a SMOP to transform that code to call a different command and extract different values from the response.

If this code is really worth money to you, I'm glad to accept sponsorship to the T&M in Orlando this year....
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klamerus
PostPosted: Tue Jun 14, 2005 5:59 pm    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

I have no idea what the T&M is but if you can provide the code described it is indeed worth a couple of hundred of $ to us. If that's more than I offered, I'm stuck though.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Wed Jun 15, 2005 3:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

klamerus wrote:
I have no idea what the T&M is but if you can provide the code described it is indeed worth a couple of hundred of $ to us. If that's more than I offered, I'm stuck though.


T&M is the Transaction & Messaging conference next month. It's roughly US$1400 for the conference...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Jun 15, 2005 4:50 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

With version 6 of WMQ, you could always turn on queue monitoring and get the last time that a message was put/got. If you saw the get value changing, you'd know that somebody was getting messages.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
klamerus
PostPosted: Wed Jun 15, 2005 6:36 am    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

There are some other tool that can do this too (I think).

The issue is that we need to install something automated. At first, this may need to be a stand-alone tool, but the company monitoring tools are SiteScope and Topaz and one (maybe both) are extendable - so the longer term solution for us is to interface from them with the code to these dequeue events.

It also appears that enqueues and dequeues are exposed via WMI (on Windows), but it's less clear on how those are tracking these and worse yet, from what I can see the WMI objects are just using unique (but unintuitive) identifies for the queues and not the names we've given them. So that's a bit difficult to sort out.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
klamerus
PostPosted: Wed Jun 15, 2005 6:38 am    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

Just a follow-on.

We're (I'm) not lazy. We just don't have time. I'm trying to do enough research here to provide something to one of my teams for them to actually code, but I'm pretty much already working 10-12 hours / day, keeping trackof 2 teenagers and so on. Just no time. I wouldn't mind the tinkering if I did.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
klamerus
PostPosted: Wed Jun 15, 2005 7:00 pm    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

Okay, lazy or not, I'm taking a spin at this and I'm getting an error that perhaps someone can help with.

I'm nodifying the AMQSAILQ.C sample, which is pretty short and somewhat similar (it loops through all the queues on a QM) to what we need. At least it's easy to test with locally.

I replaced the MQCMD_INQUIRE_Q with MQCMD_RESET_Q_STATS after setting the admin bag. So the relevant code now looks like:


if (argc > 1)
strncpy(qmName, argv[1], (size_t)MQ_Q_MGR_NAME_LENGTH);

MQCONN(qmName, &hConn, &compCode, &connReason);

if (compCode == MQCC_FAILED)
{
CheckCallResult("Queue Manager connection", compCode, connReason);
exit( (int)connReason);
}

mqCreateBag(MQCBO_ADMIN_BAG, &adminBag, &compCode, &reason);
CheckCallResult("Create admin bag", compCode, reason);

mqCreateBag(MQCBO_ADMIN_BAG, &responseBag, &compCode, &reason);
CheckCallResult("Create response bag", compCode, reason);

mqAddString(adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, "*", &compCode, &reason);
CheckCallResult("Add q name", compCode, reason);

mqAddInteger(adminBag, MQIA_Q_TYPE, MQQT_LOCAL, &compCode, &reason);
CheckCallResult("Add q type", compCode, reason);

mqAddInquiry(adminBag, MQIA_MSG_ENQ_COUNT, &compCode, &reason);
CheckCallResult("Add inquiry", compCode, reason);

mqAddInquiry(adminBag, MQIA_MSG_DEQ_COUNT, &compCode, &reason);
CheckCallResult("Add inquiry", compCode, reason);

mqExecute(hConn, MQCMD_RESET_Q_STATS, MQHB_NONE,
adminBag, responseBag, MQHO_NONE, MQHO_NONE, &compCode, &reason);


But the check on

if ( compCode == MQCC_OK )

fails and upon retrieving the values on why via the command

printf("Call to get queue attributes failed: Completion Code = %d : Reason = %d\n",
compCode, reason);

I get a completion code of 2, and a Reason code of 2324


So, obviously something isn't quite right.

Any thoughts or help?
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Thu Jun 16, 2005 3:55 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Messages - Reason Codes wrote:
MQRC_INQUIRY_COMMAND_ERROR
The mqAddInquiry call was used previously to add attribute selectors to the bag, but the command code to be used for the mqBagToBuffer, mqExecute, or mqPutBag call is not recognized. As a result, the correct PCF message cannot be generated.

Corrective action: Remove the mqAddInquiry calls and use instead the mqAddInteger call with the appropriate MQIACF_*_ATTRS or MQIACH_*_ATTRS selectors.


So change the two mqAddInquiry calls to the appropriate mqAddInteger calls.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klamerus
PostPosted: Thu Jun 16, 2005 10:24 am    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

That makes sense and it was leaning that way.

One question I have then is do I even need to provide these arguments?

If so, I can't imagine what the additional parameter for the addinteger would be. Any thought from anyone?

If the RESET automatically returns the dequeue and enqueue data, wouldn't this data be in the result bag without doing the addinteger?
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
klamerus
PostPosted: Thu Jun 16, 2005 10:37 am    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

I tried to use:

mqAddInteger(adminBag, MQIA_MSG_ENQ_COUNT, MQIACF_ALL, &compCode, &reason);
CheckCallResult("Add integer", compCode, reason);

but that generated an error with completion code 2 and Reason 3008.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
klamerus
PostPosted: Thu Jun 16, 2005 10:39 am    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

btw, the error was from the mqexecute, not during addinteger()
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Thu Jun 16, 2005 11:10 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay, Reset Queue Statistics only takes the Queue name as an input parameter.

So, only
Code:
 mqCreateBag(MQCBO_ADMIN_BAG, &responseBag, &compCode, &reason);
CheckCallResult("Create response bag", compCode, reason);

mqAddString(adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, "*", &compCode, &reason);
CheckCallResult("Add q name", compCode, reason);


And then use the various calls to extract the response parameters (documented in the PCF manual) to get the data you want. Something vaguely like
Code:
 mqInquireInteger(responseBag, MQIA_MSG_ENQ_COUNT, &myEnqCountVariable);

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klamerus
PostPosted: Thu Jun 16, 2005 1:30 pm    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

That's almost what I have. The inquire integer takes 6 parameters though and I can't figure what they are. I'm so close I can almost taste it. I'm sure I've got the parameters to the input right. It's the results bag that is got me. So close and yet so far.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jefflowrey
PostPosted: Thu Jun 16, 2005 2:36 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay.

Looking at the example code, you want to set the parameters to inquire integer as follows:
1) the bag to inquire - responseBag
2) the selector - MQSEL_ANY_SELECTOR
3) the index position - count the fields listed in the response, and use the one you want: 1- Queue High Depth, 2- MsgDeqCount, 3-MsgEnqCount, 4-QName, 5-QSGDisposition (Don't ask for this one!), 6 - TimeSinceReset
4) index value - a pointer to the variable you want to get populated
5) compCode - a pointer to your compCode variable
6) reasonCode - a ponter to your reasoncode variable.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klamerus
PostPosted: Thu Jun 16, 2005 4:43 pm    Post subject: Reply with quote

Disciple

Joined: 05 Jul 2004
Posts: 199
Location: Detroit, MI

Well, I have to say thankyou, thankyou!

For whatever reason (luck and expert support), I'm getting numbers back now (vs. failures).

I'm puzzled by the results though. I understood that the reset command would set the values of enqueue and dequeue to 0 when it was called. In other words, it would get the values at the time of the call and those two values would get reset.

That isn't happening. I would also expect tnat the enqueues would be a count of puts, and that dequeues would be a count of gets.

I also thought that after getting the queue depth to 0 after numerous gets and puts, that the two values (enqueue and dequeue) would be roughly equal (they'd have to be).

For whatever reason, these values aren't changing, and they are in gross disagreement. I keep getting an enqueue count of 17, and a dequeue count of 437.

That doesn't make any sense at all.

Am I wrong, or shouldn't the followig reset these two values to zero:

mqExecute(hConn,
MQCMD_RESET_Q_STATS,
MQHB_NONE,
adminBag,
responseBag,
MQHO_NONE,
MQHO_NONE,
&compCode,
&reason);
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2, 3  Next Page 2 of 3

MQSeries.net Forum Index » IBM MQ API Support » Sample MS VC/C++ using PCF
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.