Author |
Message
|
goldym |
Posted: Tue Feb 20, 2007 3:01 pm Post subject: LENGTH FUNCTION |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
Does any one know how to calculate the entire length of your Data. I am trying to calculate the total length of the incoming file. I tried the following ESQL below but it returns null.
DECLARE LENG int;
SET LENG = LENGTH(InputRoot.MRM.Data); |
|
Back to top |
|
 |
madi |
Posted: Tue Feb 20, 2007 3:18 pm Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
do a asbitstream and cast the data into a string
then u can use LENGTH to find its length
may not be the best way to do it but will get the job done i think
--madi |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 20, 2007 4:38 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Read the message as BLOB, ask for the length of InputRoot.BLOB.BLOB and then parse the message as MRM... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
goldym |
Posted: Thu Feb 22, 2007 6:37 am Post subject: |
|
|
Centurion
Joined: 24 Jun 2005 Posts: 116
|
[quote="jefflowrey"]Read the message as BLOB, ask for the length of InputRoot.BLOB.BLOB [i]and then[/i] parse the message as MRM...[/quote]
thanks this worked! |
|
Back to top |
|
 |
ravi_sri24 |
Posted: Thu Mar 01, 2007 9:30 pm Post subject: |
|
|
Voyager
Joined: 11 May 2006 Posts: 83
|
goldym wrote: |
jefflowrey wrote: |
Read the message as BLOB, ask for the length of InputRoot.BLOB.BLOB and then parse the message as MRM... |
thanks this worked! |
Hi journeyman,
Am also looking for the same, please could you help me out in this, is message set is required, my input message is XML,
DECALRE MESSAGE BLOB;
DECLARE Length NUMBER;
MESSAGE = (InputRoot.BLOB.BLOB)
NUMBER = LENGHT(MESSAGE)
is the a bove code will work, what needs to be entered in the INPUT NODE of the message flow
Thanks in Advance..... |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 02, 2007 1:06 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The usual style is to set the 'Message Domain' property on the input node to 'BLOB', use a Compute node to extract the length, and then either
a) use an RCD node to switch to another domain or
b) use CREATE...PARSE to switch to another domain
Quote: |
is message set is required, my input message is XML |
If you need to validate your XML message against the schema you need the MRM domain, and so you will require a message set.
If you don't need validation, you can use the XMLNSC domain. In that case, you do not require a message set, but I still advise you to create one, because it makes writing your ESQL and mappings a lot easier. |
|
Back to top |
|
 |
ravi_sri24 |
Posted: Fri Mar 02, 2007 2:38 am Post subject: |
|
|
Voyager
Joined: 11 May 2006 Posts: 83
|
kimbert wrote: |
The usual style is to set the 'Message Domain' property on the input node to 'BLOB', use a Compute node to extract the length, and then either
a) use an RCD node to switch to another domain or
b) use CREATE...PARSE to switch to another domain
Quote: |
is message set is required, my input message is XML |
If you need to validate your XML message against the schema you need the MRM domain, and so you will require a message set.
If you don't need validation, you can use the XMLNSC domain. In that case, you do not require a message set, but I still advise you to create one, because it makes writing your ESQL and mappings a lot easier. |
Hi,
Actually i want to insert the total message and message size in the table, i don't want to do anything with the message,
I have tried with the BLOB in the INPUT NODE of the message but it has failed
please suggest me, only i want insert the actual message and length of the message |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 02, 2007 2:57 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
ravi_sri24 |
Posted: Fri Mar 02, 2007 5:56 am Post subject: |
|
|
Voyager
Joined: 11 May 2006 Posts: 83
|
Hi,
If i use the BLOB Domain, then it's giving me the MQRFH2 header also, I required only Message then what should i do, here I don't require any parsing of the message just i want to insert the Message(which should not have any headers) and MessageLength in the DataBase
It's very urgent for me please some advise me |
|
Back to top |
|
 |
Vitor |
Posted: Fri Mar 02, 2007 5:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
This is kinda functioning as designed - the RFH2 is carried as part of the message body, it's the MQMD that's a header.
You may need some minimal processing to strip off the RFH2 if you don't want it stored. Better minds than mine may be able to suggest a more cunning solution.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Paul D |
Posted: Fri Mar 02, 2007 2:16 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
That makes no sense to me. All headers including the RFH headers should be parsed out into the message tree regardless of if the BLOB domain was specified on the input node. I'd be questioning if the inbound message was set up correctly with that header. If you can't control that, you should still be able to salvage the message and strip off the RFH header. _________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
whocares61 |
Posted: Sun Mar 04, 2007 6:41 pm Post subject: |
|
|
Newbie
Joined: 06 Dec 2006 Posts: 7 Location: New Zealand
|
Works for me like this:
Code: |
DECLARE cursor REFERENCE TO Root.XMLNSC.Content;
SET rsd = FIELDVALUE(cursor);
IF (LENGTH(rsd) = 0) THEN
-- do stuff
END IF;
|
 |
|
Back to top |
|
 |
kimbert |
Posted: Mon Mar 05, 2007 1:17 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
goldym wrote:
Quote: |
I am trying to calculate the total length of the incoming file. |
whocares61 : Your code does not do what goldym requires. |
|
Back to top |
|
 |
madi |
Posted: Mon Mar 05, 2007 9:15 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
u can still use the asbitstream on the XMLNS and then find the length
--madi |
|
Back to top |
|
 |
whocares61 |
Posted: Mon Mar 05, 2007 1:03 pm Post subject: |
|
|
Newbie
Joined: 06 Dec 2006 Posts: 7 Location: New Zealand
|
Quote: |
Your code does not do what goldym requires. |
Well I agree, but I thought it's easy to see how it could be applied, isn't it?
Cheers |
|
Back to top |
|
 |
|