Author |
Message
|
dipscool |
Posted: Mon Aug 14, 2006 2:59 am Post subject: Parsing Hex messages using TDS |
|
|
Novice
Joined: 14 Aug 2006 Posts: 13
|
we are planning to use Tagged/Delimited format for a MRM defnition. The message from the source system is coming in HEX format. Is there any way that I can design a TDS to parse those messages
Input Message is
X'4e616d653b5b5469746c653a4d722a46697273744e616d653a467265642a4c6173744e616d653a426c6f6767735d26416464726573733b5b486f7573654e6f3a31322a5374726565743a57696c6c6f77204176656e75652a546f776e3a53616c6973627572795d'
If not that what would be the best possibleway to parse this message.Our requirement is to check the content of the message and route it to different destination.
Any help is appreciated... |
|
Back to top |
|
 |
kimbert |
Posted: Mon Aug 14, 2006 3:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Don't be lazy! Your problem description is extremely poor. Post again, this time providing the following:
- which version and CSD level of the broker you are using
- a human-readable version of your message
- what kind of checks you want to carry out on the message before you forward it |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 14, 2006 3:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you sure that's the input message?
Or is it only showing up that way because you're parsing it as BLOB and then trying to view it as string data?
Maybe you should ask the people who send the message what it looks like. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
dipscool |
Posted: Mon Aug 14, 2006 4:46 am Post subject: |
|
|
Novice
Joined: 14 Aug 2006 Posts: 13
|
Sorry about inconvenience caused. Let me explain it clearly.
1. Version of Message Broker - 5.0 with fixpack 7
2.Human readable version - I do not have the readable version of the message exaclty but i do have the structure of the message saying what
is the name of the tag and delimiter based on which I can design a TDS format.
3.Checks that need to be performed - value of three to four different fields based on which the routing has to happen.
4.Regarding the human readable fromat I do not have that now but i do have the message structure defined in a word document as explained above.
I hope i answer your questions correctly this time. |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Aug 14, 2006 4:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Does the structure of the message match what can be parsed with TDS? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Aug 14, 2006 4:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I do not have the readable version of the message exaclty |
I do - it's straightforward ASCII text:
Code: |
Name;[Title:Mr*FirstName:Fred*LastName:Bloggs]&Address;[HouseNo:12*Street:Willow Avenue*Town:Salisbury] |
This message format can easily be parsed by the TDS parser using the 'Tagged Delimited' Data Element Separation style. You might need to convert it from hex to text first, depending on the answer to Jeff's question. |
|
Back to top |
|
 |
dipscool |
Posted: Tue Aug 15, 2006 8:53 pm Post subject: |
|
|
Novice
Joined: 14 Aug 2006 Posts: 13
|
Thanks. I am new to message broker. Wanted to know is there anyway that I can cpvert the input message which is in Hex format to TEXT string.
I tried the same but couold not succeed.I designed as message flow with MQInput -> Cmopute->MQOutput
I have set the Domain of MQInput as BLOB and in the compute node i tried various options of casting but no luck.
Appreciate if you can tell me what is the best way to convert the ex message to Text format and then parse it using TDS parse.
Appreciate your help. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Aug 16, 2006 12:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Something like this ( code not tested )
Code: |
-- Set the options to be used by ASBITSTREAM and CREATE ... PARSE
-- to be FolderBitStream
DECLARE parseOptions INTEGER RootBitStream;
-- Parse the BLOB
CREATE LASTCHILD OF OutputRoot DOMAIN 'MRM' PARSE( InputBody.BLOB
ENCODING InputProperties.Encoding
CCSID InputProperties.CodedCharSetId
SET 'JMKCC30002001'
TYPE 'message'
FORMAT 'XML'
OPTIONS parseOptions);
|
If you search for 'CREATE LASTCHILD Domain MRM PARSE' in this forum you will find a few more useful posts on this subject. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 16, 2006 1:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Or just don't set the Domain on the MQInput to BLOB - but set it to match your MRM definitions....
You're asking fairly basic questions about WMB. You should really spend more time reading the documentation and get some training. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jbanoop |
Posted: Wed Aug 16, 2006 4:28 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
Kimbert,
on an off topic note .. what tool did you use to get the ascii for the blob value that dipscool posted ?
Regards,
Anoop |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 16, 2006 4:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
jbanoop wrote: |
Kimbert,
on an off topic note .. what tool did you use to get the ascii for the blob value that dipscool posted ?
Regards,
Anoop |
I used to have a perl one-liner that would do this, using unpack. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ydsk |
Posted: Wed Aug 16, 2006 1:10 pm Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Here is one tool.....download it:
http://bluefive.pair.com/hexwrite.htm
I never used it though.
Search for 'Hex to ASCII' and you might hit some more tools. I had a different tool but don't remember its name.
Thanks.
ydsk. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 17, 2006 12:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Code: |
perl -e "print pack('H*','6162');" |
produces the output string 'ab'
I'm using ActiveState Perl, but this should work with any version of Perl. |
|
Back to top |
|
 |
|