Author |
Message
|
sebastia |
Posted: Sun Mar 16, 2014 5:28 am Post subject: how to parse the Command Server response |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
I have sent a nice request to Command Server,
using the SYSTEM.ADMIN.COMMAND.QUEUE queue
The request message has been created usinf this ESQL code :
Code: |
CALL CopyMessageHeaders();
SET OutputRoot.MQMD.MsgType = MQMT_REQUEST;
SET OutputRoot.MQMD.Format = MQFMT_ADMIN;
SET OutputRoot.MQMD.ReplyToQ = 'QL.RESP' ;
SET OutputRoot.MQMD.MsgSeqNumber = 1;
SET OutputRoot.MQMD.Encoding = 546;
CREATE FIELD OutputRoot.MQPCF;
DECLARE refRequest REFERENCE TO OutputRoot.MQPCF;
SET refRequest.Type = MQCFT_COMMAND;
SET refRequest.StrucLength = MQCFH_STRUC_LENGTH;
SET refRequest.Version = MQCFH_CURRENT_VERSION;
SET refRequest.Command = MQCMD_INQUIRE_Q ; -- cmd := inquiry queue ;
SET refRequest.MsgSeqNumber = 1;
SET refRequest.Control = MQCFC_LAST;
/* First parameter: Queue Name */
SET refRequest.Parameter[1] = MQCA_Q_NAME;
SET refRequest.Parameter[1].* = 'QL.TEST' ;
set refRequest.ParameterList[1] = MQIACF_Q_ATTRS ;
set refRequest.ParameterList[1].* = MQIA_CURRENT_Q_DEPTH ;
SET OutputRoot.BLOB.BLOB = asbitstream(OutputRoot.MQPCF);
SET OutputRoot.MQPCF = null;
SET OutputRoot.MQRFH2 = null; -- just in case
|
It works fine, as in the queue specified in ReplyToQ field, I get a nice message:
Code: |
00000000: 0200 0000 2400 0000 0100 0000 0D00 0000 '....$...........'
00000010: 0100 0000 0100 0000 0000 0000 0000 0000 '................'
00000020: 0300 0000 0400 0000 4400 0000 E007 0000 '........D...α...'
00000030: 0000 0000 3000 0000 514C 2E54 4553 5420 '....0...QL.TEST '
00000040: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000050: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000060: 2020 2020 2020 2020 0300 0000 1000 0000 ' ........'
00000070: 1400 0000 0100 0000 0300 0000 1000 0000 '................'
00000080: 0300 0000 1600 0000 '........ ' |
I can read it in binary, jejeje, but not from ESQL.
First comes the CFH header:
Code: |
struct tagMQCFH {
MQLONG Type; /* Structure type */
MQLONG StrucLength; /* Structure length */
MQLONG Version; /* Structure version number */
MQLONG Command; /* Command identifier */
MQLONG MsgSeqNumber; /* Message sequence number */
MQLONG Control; /* Control options */
MQLONG CompCode; /* Completion code */
MQLONG Reason; /* Reason code qualifying completion code */
MQLONG ParameterCount; /* Count of parameter structures */
}; |
CC and RC are both 0.
Struct Length is 0x24 and there are 3 structures following
1st : x'0400 0000 4400 -> MQCFT_STRING, length 'x44, queue name
2nd : x'0300 0000 1000 0000 1400 0000 0100 0000 -> MQCFIN, an integer value follows, lng 0x10, 0x14 = Queue Type, 01 = local queue ;
3rd : x'0300 0000 1000 0000 0300 0000 1600 0000 -> MQCFIN, an integer value follows, lng 'x10, 0x03 = current queue depth, 0x16 is q depth = 22.
All is fine, it is correct : the queue has 22 messages.
Can somebody teach me how to read this from ESQL code ?
I want to have the queue depth in a ESQL variable ...
The message is in a MQ Input node, with no Message Domain, as there is no PCF neither CFH domain or parser available from the drop-down menu ...
Have been reading about MQCFH parser :
>>> http://www-01.ibm.com/support/knowledgecenter/api/content/SSKM8N_7.0.0/com.ibm.etools.mft.doc/ad09660_.htm?locale=en
Spent all day in Knowledge Center ...
>>> http://www-01.ibm.com/support/knowledgecenter/
... with no luck
If the question is again "why do you want to read the queue depth", then the answer is "I want to be able to read any queue integer value", as CLWLPRTY, cluster priority, which we shall change if the queue depth grows to much and too fast.
Any pointer is welcome ! Any clue !!
I can post the running code when I have it, jejeje
Sebastian. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Mar 16, 2014 5:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you really felt like it, you could build a DFDL model of PCF messages. |
|
Back to top |
|
 |
sebastia |
Posted: Sun Mar 16, 2014 5:50 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Jeff : I would LOVE TO DO IT ... sure
Just teach me how to do it !
Now I am trying
Code: |
SET Environment.PCF = InputRoot.PCF ; --- for the trace node : nothing
SET Environment.MQMD = InputRoot.MQMD ; --- for the trace node : all ok
SET OutputRoot.XMLNSC.rsp = 'CMD Server answer. Param Cnt {' || InputRoot.MQPCF.ParameterCount || '}.' ; |
... and find there is no MQPCF header : I have a trace node and a MQ Output node later, and nothing shows up.
The problem with MB is that XMLNSC.rsp shows EMPTY, nothing, zero.
No error report, but no text in output.
Ugly.
Sebastian, googling "how to build a DFDL model of PCF message", jejeje |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Mar 16, 2014 3:25 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why would you be using XMLNSC?
That's only for XML data.
PCF messages are just fixed format records, with a variable number of records in each message, based on the type of message and etc. etc. etc.
So you could build a DFDL message set that modelled each of the structures and build a message that contains the right pieces with the right set of repeats.
I personally wouldn't do it, myself.
I'd try to find a way to use an existing PCF parser. |
|
Back to top |
|
 |
sebastia |
Posted: Sun Mar 16, 2014 11:08 pm Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
I am using XMLNSC for the Output message.
I want it to have this structure :
<rsp> some text I create </rsp>
The "some text I create" string should contain the queue depth value I got from PCF.
But as there is no PCF header, the string comes up empty
Use an existing PCF parser ? I will go this way.
Thanks, Jeff.
Sebastian. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 17, 2014 1:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I think that the PCF parser that comes with Message Broker is not acutally for MQ PCF messages.
So InputRoot.PCF is not a PCF message tree. It's, you know, that other PCF thing. Somewhere, from someone. |
|
Back to top |
|
 |
sebastia |
Posted: Mon Mar 17, 2014 2:16 am Post subject: |
|
|
 Grand Master
Joined: 07 Oct 2004 Posts: 1003
|
Hi !
I understand what you mean.
Input.PCF is not what I expect, ok
But, how do I scan / parse the Command Server response ?
Shall call my Madrid coleagues ...
Thanks ! Sebastian. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 17, 2014 12:58 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Well, again.
You *could* create a DFDL model.
You *could* parse it as BLOB.
You *could* think of another PCF parser that might be available from some transformation interface.
I can't comment on how you *should* do. |
|
Back to top |
|
 |
dleditschke |
Posted: Thu Sep 04, 2014 9:02 pm Post subject: |
|
|
Newbie
Joined: 04 Sep 2014 Posts: 1
|
Did anyone find a way to parse the response message into something more meaningful? |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Sep 05, 2014 4:24 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you tried parsing the message content in Java? Excellent pcf support in Java...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|