Author |
Message
|
adoyle65 |
Posted: Wed Jun 02, 2004 9:25 am Post subject: Converting Blob to MRM |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
I have a message flow that will receive up to 10 different messages to process. The contents and size of these messages will differ except for the first eight bytes which will have a product number and a function number. My thought was to receive the message a a blob and then parse out the first eight bytes so as I would know what message set to convert to. I have read some posts on this topic but I am somewhat confused on the route to label node. If my only options are to have the first or last labelname property how do I route messages that are sixth or seventh in the destination list?
Also is this the best way to approach this? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 02, 2004 9:31 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Your code should decide which single label is appopriate, and then set the destination list to only hold that single label.
You only put multiple items in a destination list if you need to go to more than one place - and you don't in this case.
And you might think about modeling your data using TDS and your first 8 bytes as tags. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
adoyle65 |
Posted: Wed Jun 02, 2004 11:07 am Post subject: |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
I have no say in the format the messages arrive at our queue. They are created using C header files. So I don't think the TDS helps here. I understand my code should decide where to route the message, so are you saying in a compute node to determine the function id of my message and then set the destination list to the labelname based on that? If so would I not need 10 label nodes? I will have 10 distinct messages to deal with. Is that the best way?
Thanks |
|
Back to top |
|
 |
kirani |
Posted: Wed Jun 02, 2004 11:22 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Yes, I believe that's what you will need. It'd be good if you use "function id" as your "label name". In that case you don't need any IF ... ELSE structure to set the destinationList.
It's a good idea to read message input message as BLOB and then parse first 8 bytes to get routing related data. You can use CAST with CCSID function to parse it.
If you don't know already, this is how you will set the routing list.
Code: |
SET MYFUNC CHAR;
SET MYFUNC = SUBSTRING(CAST (InputRoot."BLOB"."BLOB" AS CHAR CCSID InputRoot.Properties.CodedCharSetId) FROM 1 FOR 8);
SET OutputLocalEnvironment.Destination.RouterList.DestinationData.labelname = MYFUNC;
|
Make sure you pass "DestinationList" in your compute node. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
EddieA |
Posted: Wed Jun 02, 2004 11:23 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
If so would I not need 10 label nodes? I will have 10 distinct messages to deal with |
Yes. And your Compute node would decide which one to use, and set ONLY that one in the DestinationList.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 02, 2004 11:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you need to do ten separate pieces of logic, then you need ten separate label nodes.
Think of a label node as a named GOTO. Or a switch clause in a case statement. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
adoyle65 |
Posted: Wed Jun 02, 2004 12:25 pm Post subject: |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
Quote: |
Make sure you pass "DestinationList" in your compute node |
Not sure I know what you mean here.
Could you explain some more.
Thanks for the advice so far |
|
Back to top |
|
 |
JT |
Posted: Wed Jun 02, 2004 2:04 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Since the DestinationList is within the LocalEnvironment tree you need to ensure that the LocalEnvironment setting has been selected for the compute mode (the parameter can be found on the advanced tab of the compute node for v2.1, right-click and select properties of the compute node for v5.0) |
|
Back to top |
|
 |
adoyle65 |
Posted: Fri Jul 02, 2004 7:45 am Post subject: |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
I have tried to get this to work with no success. The first eight bytes in my message are integers. When I do the substring from 1 to 8 I seem to be getting just 8 characters from the blob string. I need to get the second integer value from the input message and route based on that. I managed to get the X'b1bd0000' value of the second integer but when I try to cast it to integer to get the int representation I get an error.
Any clues?? |
|
Back to top |
|
 |
kirani |
Posted: Fri Jul 02, 2004 9:33 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Can you tell us how exactly the integer numbers are represented in your message? I'd like to know the data format of the message. For example integer number output by C program will be different than the output generated by COBOL program (PIC 9(4)). _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
adoyle65 |
Posted: Fri Jul 02, 2004 9:47 am Post subject: |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
Hi,
The message comes from an ALPHA VMC C application. They are 4 byte Little Endian integers.
Thanks |
|
Back to top |
|
 |
kirani |
Posted: Fri Jul 02, 2004 9:49 am Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
In that case you need to use MRM to parse this message. You cannot use CAST function to convert BLOB to Integer data type. It works for numerics, which are represented in string format. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
adoyle65 |
Posted: Fri Jul 02, 2004 12:11 pm Post subject: |
|
|
Apprentice
Joined: 18 Feb 2004 Posts: 37 Location: Canada
|
So let me get this straight, even though I know my first eight bytes in my blob are are ints, that I can not substring and cast from the blob because they are actually numeric values and not characters representing numbers?
The only way to do this is with MRM.
Thanks |
|
Back to top |
|
 |
kirani |
Posted: Fri Jul 02, 2004 12:23 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Yes.
You need to model your messae in MRM if your input data is coming in as integer data type, for example int in C or signed decimals (including packed) in COBOL. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
EddieA |
Posted: Fri Jul 02, 2004 4:49 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
But, all you need to do is model an MRM that descibes those 8 bytes. Then you can substring and parse.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|