Author |
Message
|
Divs09 |
Posted: Fri Oct 31, 2008 6:10 am Post subject: Parsing a message in tabular format. |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
Hi all,
I am using IBM Websphere MQ Integrator Control Center 2.1 for developing Message flows.
I am having a requirement to handle an input message in tabular format, such that the values appear like :
A,B,C,D,E
Val1,Val2,Val3,Val4,Val5
- Just two rows, wherein the header names are fixed, but the value field will change.
I have worked on Handling input message in XML format, but have no clue what needs to be done for this one.
Some googling suggests that MRM parser can be used for this. But, since I have had no exposure on any such kinda thing before, I need some help on syntax.
Anybody 4 ?
ta
Divi |
|
Back to top |
|
 |
kimbert |
Posted: Fri Oct 31, 2008 7:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Stating the obvious, but you *really* need to upgrade to a supported version of the product. v2.1 has been out of service for years. There are very few people left who even remember what Control Center looks like.
I did give some pointers on your DeveloperWorks thread where you posted the same question. Did you try using the TDS format with 'All Elements Delimited'? If so, what problems did you encounter? |
|
Back to top |
|
 |
Divs09 |
Posted: Fri Oct 31, 2008 7:55 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
Hi Hurley,
We are on our way upgrading our application, but we need solution for this one before that. Are you referring to my post in IBM forum ?(Because I just lost the login for that )
I did see one related post about handling such message, but I have no experience of working with the one with TDS format too.
Do we have any example code here, because my problem is straight forward to solve..
It's just that I receive a message like
A,B,C,D
1,2,3,4
and I need to find, what value has been received corresponding to 'B' !!
Cheers,
Divya |
|
Back to top |
|
 |
kimbert |
Posted: Fri Oct 31, 2008 8:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
In the circumstances, you are probably better off writing some ESQL to extract that field. Constructing a message set using the v2.1 Control Center is not worth the hassle if you are about to upgrade anyway.
I don't remember which ESQL functions were available back in the v2.1 days. Have you checked the ESQL manual for functions which allow you to split up a string? |
|
Back to top |
|
 |
Divs09 |
Posted: Fri Oct 31, 2008 9:09 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
That's wht my concern was I didn't want to learn and then write a new piece of code for that.
I tried to look for proper ESQL function on net, but there is not enough material there ..
I know few function to extract the substrings and to look for a pattern BUT BUT ..those functions are applicable for the XML message..not sure how they would handle the message just in a form of string.
For instance, for an XML input it would be InputRoot.XML.MESSAGE.BLAHBLAH
but what in this case ?
Divi |
|
Back to top |
|
 |
kimbert |
Posted: Fri Oct 31, 2008 9:22 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - I see your problem. Try this:
- Set the 'Domain' property on the input node to 'BLOB'
- In your ESQL, use the CAST function to convert InputRoot.BLOB.BLOB to a CHARACTER type, and assign the result to a CHARACTER variable
- Now use string manipulation functions to extract your field. |
|
Back to top |
|
 |
Divs09 |
Posted: Wed Nov 05, 2008 2:08 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
Hello,
Firstly, apologies for not coming back any sooner on this.
I have tried the suggestion given by you, but somehow seems I am missing on the something somewhere.
Here is the summary of what I have done :
In the input node, I set Message Domain and Message Format as BLOB(if I don't set this way in both of them the message goes to failed queue with Parser error.)
My Input Message was something like this :
"JOB","LQN","REF","PHONE","STAT","DATE","TIME","RT"
"58400556","","786768_1","","ACK","07/10","08:59",""
Now when I trace my message, it is converted in to some format like this :
<2008-11-04 17:11:58.280998> : PARSED Message :[Message Flow name]
(
(0x3000000)BLOB = X'224a4f42222c224c514e222c22524546222c2250484f4e45222c2253544154222c2244415445222c2254494d45222c225254220a223538343030353536222c22222c223738363736385f31222c22222c2241434b222c2230372f3130222c2230383a3539222c2222'
) ;
So, it seems that the transformation went properly.
Now, when I send this message to my Compute Node
DECLARE cEDT_DOC_ID CHAR ;
SET cTempvar = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId) ;
SET OutputRoot.BLOB.BLOB = cTempVar ;
I can't see anything out of this node, neither in the failed queue nor in any of the trace node of the output msg.
I don't know what is happening to these messages and who is eating them up !!!
Any clue ??
Divi |
|
Back to top |
|
 |
Divs09 |
Posted: Wed Nov 05, 2008 2:12 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
Sorry, the code pasted in the last post is somehow misleading :
Pls refer to this one..
DECLARE cTempVar CHAR ;
SET cTempVar = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId) ;
SET OutputRoot.BLOB.BLOB = cTempVar ; |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 05, 2008 2:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
Divs09 |
Posted: Wed Nov 05, 2008 9:53 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
Wow ! whole day gone and result is absolutely ZERO !!
So, to begin with I started with the mqsichangetrace option, which worked but on mqsireadlog even after deploying the config.manager, I am getting error saying .. The broker Configuration is yet not deployed.
I have tried couple of things for transforming the BLOB input to string..but nothing seem to work :
Here is what all tried :
DECLARE cTrans CHAR ;
DECLARE cTest CHAR ;
-- Different Casting I tried ..
/* SET cTrans = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId) ; */
/* SET cTrans = CAST(SUBSTRING(InputRoot.BLOB.BLOB FROM 1 FOR 3) AS CHARACTER CCSID 1208); */
SET cTrans = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID 1208) ;
SET cTest = 'Pass';
SET OutputLocalEnvironment.Variables.ValidMsg = cTrans ;
SET OutputLocalEnvironment.Variables.Test = cTest ;
SET OutputLocalEnvironment.Variables.Test2 = 'Passed' ;
And after parsing My message looked like the BLOB exactly what I had posted in my previous post.
Now, I tried something new on my Trace node by populating the local environment variable, but everytime I received a NULL value even after hardcoding the String in my compute node for the reason UNKNOWN !
<${CURRENT_TIMESTAMP}> : PARSED Message :[GMC_F_ExpediteFaxAck_MessageRoute]
[Environment Variable is] : ${Environment.Variables.ValidMsg};
[Environment Variable is] : ${Environment.Variables.Test};
[localEnvironment Variable is] : ${LocalEnvironment.Variables.ValidMsg};
[localEnvironment Variable is] : ${LocalEnvironment.Variables.Test};
[Onemoretest] : ${LocalEnvironment.Variables.Test2} ;
[Twomoretest] : ${Environment.Variables.Test2} ;
[LocalEnv] : ${LocalEnvironment};
${DestinationList};
[Message Body ] : ${Body};
[This is coming in Root part] : ${Root};
This gives output as :
<2008-11-05 16:35:11.562> : PARSED Message :
[Environment Variable is] : NULL;
[Environment Variable is] : NULL;
[localEnvironment Variable is] : NULL;
[localEnvironment Variable is] : NULL;
[Onemoretest] : NULL ;
[Twomoretest] : NULL ;
[LocalEnv] : ;
;........
In a nutshell, so far whatever I have tried to convert the BLOB to extract the string output is all in vain...
And I don't understand that why there is no value stored in the local env var I am using...Am I missing on something????? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 05, 2008 11:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I can't see anything obviously wrong. Anyone else? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 05, 2008 12:29 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm still confused about what version Divs09 is using.
I don't see code where Environment.Variables is assigned, so I can't say why it's NULL. It's also not shown what properties are set on the Compute node, so I can't say if it's correct that LocalEnvironment is not populated.
I also don't understand how Divs09 is getting trace node output from a configmgr that says it does not have a deployed Broker configuration. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 05, 2008 2:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
At the same time I don't know what happens when you assign a char variable to a BLOB type without casting it first to BLOB...
See:
Divs09 wrote: |
DECLARE cTempVar CHAR ;
SET cTempVar = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId) ;
SET OutputRoot.BLOB.BLOB = cTempVar ; |
Shouldn't that have been assigned to some element and switched to a BLOB in a RCD node? Or cast back to a BLOB before the assignment...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Divs09 |
Posted: Thu Nov 06, 2008 1:26 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
@ MQJeff - I am using WMQI 2.1.
The environment variable is set in Compute node, like
SET OutputLocalEnvironment.Variables.ValidMsg = cTrans ; (rest in the previous post.)
and then I tried to display it in trace node, to check what transformation is done -
localEnvironment Variable is] : ${LocalEnvironment.Variables.ValidMsg};
Environment Variable is] : ${Environment.Variables.ValidMsg};
Which results a null value. Isn't that the correct syntax ??
Lastly, the error about Broker config deployment was a reply to Kimbert's suggestion to start the debug trace on from command prompt. So, I had seen that error in cmd prompt not trace node.
Hope that clears it all.
Now anything clicks to you guys !  |
|
Back to top |
|
 |
Divs09 |
Posted: Thu Nov 06, 2008 1:36 am Post subject: |
|
|
Newbie
Joined: 31 Oct 2008 Posts: 9
|
@ Saper -
I have already changed that syntax, to display local env variable.
At the same time, I would like to know that since I am using BLOB format so my input has changed to BLOB, but after performing my check I need to send my message as it is..
i.e. exactly same as my input :
"JOB","LQN","REF","PHONE","STAT","DATE","TIME","RT"
"58400556","","786768_1","","ACK","07/10","08:59",""
so how do I need to convert my message back to it's orginal format ?
I have assigned InputRoot = OutputRoot, but not sure if it solves the purpose.
I am not very much acquainted with this domain, so any help would be appreciated. Thanks
Divi |
|
Back to top |
|
 |
|