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 » General Discussion » how to use MQCMD_INQUIRE_CHANNEL_STATUS

Post new topic  Reply to topic Goto page 1, 2  Next
 how to use MQCMD_INQUIRE_CHANNEL_STATUS « View previous topic :: View next topic » 
Author Message
sebastia
PostPosted: Mon Apr 01, 2013 12:31 pm    Post subject: how to use MQCMD_INQUIRE_CHANNEL_STATUS Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Hi, coleagues.

I want to inquire the number of bytes sent /received thru a channel.

Using ...

>>> http://publib.boulder.ibm.com/iseries/v5r1/ic2924/books/csqzat01.pdf

... I know I have to use MQCMD_INQUIRE_CHANNEL_STATUS thru MQAI and that the "provided" sample is "amqsailq.c"

But it looks to me that trying to fill the bags is not an obvious task ...
and more when I read

... returned if requested: ... BuffersReceived, BuffersSent, BytesReceived, BytesSent, ...

Can someone provide a C code sample reading those values ?

Thanks. Sebastian.
Back to top
View user's profile Send private message Visit poster's website
exerk
PostPosted: Mon Apr 01, 2013 11:57 pm    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

I think amqsailq.c is the C code sample?
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
sebastia
PostPosted: Tue Apr 02, 2013 12:10 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

No.
AMQSAILQ.C inquires a queue depth, and I want to inquiry the bytes sent thru a channel.
Guess the shape of the program shall be similar, but with the channel

AMQSAILQ.C struct :

Code:
// set queue name
mqAddString(adminBag, MQCA_Q_NAME, MQBL_NULL_TERMINATED, "*", &compCode, &reason);
// set queue type
mqAddInteger(adminBag, MQIA_Q_TYPE, MQQT_LOCAL, &compCode, &reason);
// set what we want to are inquire
mqAddInquiry(adminBag, MQIA_CURRENT_Q_DEPTH, &compCode, &reason);
// send request
mqExecute(hConn, MQCMD_INQUIRE_Q, ...


I can write similar code for a channel, but then I find ...

>>> http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fpc12470_.htm

Returned if requested: ... BuffersReceived, BuffersSent, BytesReceived, BytesSent, ...

.. and I have no clue how to code that !

Just for your info : there is something similar in "java" samples :
<mq\tools\pcf\samples\PCF_ChannelStatus.java
Back to top
View user's profile Send private message Visit poster's website
exerk
PostPosted: Tue Apr 02, 2013 12:28 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

sebastia wrote:
No.
AMQSAILQ.C inquires a queue depth, and I want to inquiry the bytes sent thru a channel.

Doh! That'll teach me to shoot from the lip! What about amqsaicl.c, which is inquire channel?
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
sebastia
PostPosted: Tue Apr 02, 2013 12:41 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

We all do mistakes, mr EXERC, but still want to help ()
This sample does return the "mamdatory" fields I'd say ...

Reading here

>>> http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/index.jsp?topic=%2Fcom.ibm.mq.doc%2Fpc12470_.htm

... it says ...

Quote:
Always returned:
ChannelDisposition, ChannelInstanceType, ChannelName, ChannelStatus, ChannelType, ConnectionName, RemoteApplTag, RemoteQMgrName, StopRequested, SubState, XmitQName


... and then the misterious ..

Quote:
Returned if requested:
Batches, BatchSize, BatchSizeIndicator, BuffersReceived, BuffersSent, BytesReceived, BytesSent, ChannelMonitoring,


Specifically, what I dont know how to do is ... "request "BytesSent" ...

But THANKS for the pointer to the sample .... I'll run it in a while ...

Another diference is ... the provided sample uses
MQCMD_INQUIRE_CHANNEL, /* Command to be executed */
whilst I want to use (I supose) MQCMD_INQUIRE_CHANNEL_STATUS ...


Sebastian.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Tue Apr 02, 2013 4:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'd use a plain PCF message and not use the the MQAI api. It's weird, and the notion of bags don't make any dang sense.

It's frightfully easy in Java, but here's something close in C
http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.doc/pc15410_.htm


But again, much easier in Java.
Back to top
View user's profile Send private message
sebastia
PostPosted: Tue Apr 02, 2013 4:48 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

PCF instead of MQAI - I agree - I dont like bags either

Java - no problem - I have already read
...
>>> <MQ base>\tools\pcf\samples\PCF_ChannelStatus.java
... it goes

Quote:
// create pcf message type
PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_CHANNEL_STATUS);
// add channel name
pcfCmd.addParameter(MQConstants.MQCACH_CHANNEL_NAME, PCF_CommonMethods.pcfChannel);
// execute the command
PCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);
// get channek status
int chStatus = ((Integer) (pcfResponse[0].getParameterValue(MQConstants.MQIACH_CHANNEL_STATUS))).intValue();


But .. how do I do to get the number of bytes sent or received ?

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Tue Apr 02, 2013 4:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

By asking for the right data back or asking for all data back and then finding the data you want.
http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/topic/com.ibm.mq.doc/pc12430_.htm
Back to top
View user's profile Send private message
sebastia
PostPosted: Tue Apr 02, 2013 5:13 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Found it, Jeff - MQIACH_BYTES_RCVD and/or MQIACH_BYTES_SENT

But I guess you would agree with me that a working sample would be of great help ... jeje

I know you have already done all this way, but I am just at the beginning ...

Thanks a lot. Sebastian.
Back to top
View user's profile Send private message Visit poster's website
sebastia
PostPosted: Tue Apr 02, 2013 8:00 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

I have modified the code in

>>> http://pic.dhe.ibm.com/infocenter/wmqv7/v7r5/index.jsp?topic=/com.ibm.mq.doc/pc15410_.htm

Now it goes like this

Code:
// Setup request header
pPCFHeader -> Command = MQCMD_INQUIRE_CHANNEL_STATUS ;
// Setup parameter block
pPCFString -> Parameter = MQCACH_CHANNEL_NAME ;
memcpy ( pPCFString -> String, "QL.PCFS.RESP\0", 13 ) ; // chanel name


If I run it like this, I get 2 messages from Command Server, one 52 bytes, other 36 bytes - still have to decode them.

My question now is : HOW TO SPECIFY that all I want is the number of received bytes, using MQIACH_BYTES_RCVD ?

Has to be something like that :
Code:
/* Setup parameter block */
     pPCF_Integer_List -> Type        = MQCFT_INTEGER_LIST ; // channel instance attributes is a integer list, MQCFIL
     pPCF_Integer_List -> StrucLength = MQCFIL_STRUC_LENGTH_FIXED ;
     pPCF_Integer_List -> Parameter   = ????
     pPCF_Integer_List -> Count       = 1 ;
     pPCF_Integer_List -> Values[0]   = MQIACH_BYTES_SENT ;


What goes in PARAMETER field ? MQIA_ACTIVE_CHANNELS ???

Thanks for any help.
Sebastian.
Back to top
View user's profile Send private message Visit poster's website
bruce2359
PostPosted: Tue Apr 02, 2013 10:32 am    Post subject: Reply with quote

Poobah

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

Refer to WWMQ Constabts manual.

IA = integer attribute; CA = character attribute
_________________
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
sebastia
PostPosted: Tue Apr 02, 2013 10:45 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

I am reading "MQ_v7_PCF_and_AI_csqzac06.pdf" and "cmqcfc.h" ...

Guess "WMQConstants manual" is MQ_v7_Constants_csqzaf10.pdf

I know what IA and CA mean, and now have entered the integer list world.

If a parameter of mine is wrong ... could you simply indicate it ?

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed Apr 03, 2013 6:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The source for MS03 is a good sample on how to write and parse PCF requests and responses in C.

You will put MQIACH_CHANNEL_INSTANCE_ATTRS in your Parameter.
Quote:

ChannelInstanceAttrs (MQCFIL)
Channel instance attributes (parameter identifier: MQIACH_CHANNEL_INSTANCE_ATTRS).



You want to build a PCF message that is equivalent to the MQSC command "DIS CHSTATUS(channel_name) BYTSRCVD".
Back to top
View user's profile Send private message
sebastia
PostPosted: Wed Apr 03, 2013 10:29 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Thanks, Jeff - those pages are really dense ...

Yes, I think I can send that command after stopping the Command Server so I can have a look at the contents ...

... or maybe you mean I have to look at the response to that command to understand what comes back in the response ... ?

Sebastia.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Wed Apr 03, 2013 11:24 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I guess I meant that PCF==MQSC. So you should sort of think of it that way.

That you build a piece that represents "DISPLAY CHSTATUS", then you build a piece that represents "(channel_name)" then you build a piece that represents "BYTSRCVD".

And if you run that command in MQSC, it will produce a response that will help you understand the pieces of the PCF response messages.

The pieces of the response message are built in the same way as the pieces of the request message. So you'll get back a PCF header and then a PCF parameter block that indicates that it's MQIACH_BYTES_SENT or MQIACH_BYTES_RCVD and it will have a value that is the actual number of bytes received (and be an integer).

Again, if you issue the MQSC command and look at the response, you can use amqsbcg to dump out the PCF response and match up values.

but you end up looking up a lot of symbolic constants to find their actual value...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General Discussion » how to use MQCMD_INQUIRE_CHANNEL_STATUS
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.