Author |
Message
|
lung |
Posted: Wed Sep 04, 2002 7:52 pm Post subject: BLOB ESQL Syntax Error |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
I'm facing some problems when trying to refer to the bytes in a BLOB message. The following is my ESQL in the compute node:
SET B BLOB;
SET B = InputBody.BLOB.BLOB;
But it gives me a syntax error at BLOB (bold). What gives? I tried using InputRoot instead of InputBody but it gives the same error. Am I suppose to use InputBody or InputRoot? What's the difference?
If my message is 'ABC', what will B look like?
Thanks. _________________ lung |
|
Back to top |
|
 |
lillo |
Posted: Wed Sep 04, 2002 10:01 pm Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Replace InputBody with InputRoot or use InputBody.BLOB
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
lung |
Posted: Wed Sep 04, 2002 10:40 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
It doesn't make any difference... Syntax error will occur whenever I try to code BLOB in my ESQL, thus resulting in error when I try to deploy.
Thanks. _________________ lung |
|
Back to top |
|
 |
lillo |
Posted: Thu Sep 05, 2002 2:16 am Post subject: |
|
|
Master
Joined: 11 Sep 2001 Posts: 224
|
Sorry for the wrong answer. Now I found the error. Replace the first line with
Cheers, _________________ Lillo
IBM Certified Specialist - WebSphere MQ |
|
Back to top |
|
 |
mq_developer |
Posted: Thu Sep 05, 2002 3:02 pm Post subject: |
|
|
Voyager
Joined: 18 Feb 2002 Posts: 82
|
Your code should be like this
DECLARE B BLOB;
SET B = InputRoot."BLOB"."BLOB";
Note that BLOB is enclosed between double quotes , all the keywords and reserved words should be enclosed in quotes whenever they are part of the reference.
Hope this helps
-- Ram -- |
|
Back to top |
|
 |
lung |
Posted: Thu Sep 05, 2002 5:39 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Sorry, I posted wrongly. I did put DECLARE in my compute node
"BLOB"? I will try that. But why is it that we do not need to put quotations when we put MRM or XML? (eg. InputRoot.MRM or InputRoot."MRM" gives no syntax error either way)
Thanks. _________________ lung |
|
Back to top |
|
 |
kirani |
Posted: Thu Sep 05, 2002 6:26 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Probably you are getting syntax error for second BLOB. What happens if you use this:
SET B = InputRoot.BLOB."BLOB"; _________________ 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 |
|
 |
lung |
Posted: Thu Sep 05, 2002 11:23 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
Using "BLOB" instead of BLOB gives me no syntax error, but I wonder if it's actually working because B returns nothing.
Here is my complete code in my compute node...
Code: |
DECLARE I INTEGER;
SET I = 1;
WHILE I < CARDINALITY(InputRoot.*[]) DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE B BLOB;
SET B = InputRoot."BLOB"."BLOB";
SET OutputRoot."BLOB" = CAST(B AS CHAR); |
Input message consists of 'ABC'. The output message turns out to be zero in length (nothing at all!). What is wrong?
Thanks everyone.
 _________________ lung |
|
Back to top |
|
 |
ernest-ter.kuile |
Posted: Fri Sep 06, 2002 3:42 am Post subject: |
|
|
 Apprentice
Joined: 13 May 2002 Posts: 49 Location: KLM Holland
|
it isn't necessary to put quotes arround keywords in this context anymore.
lung wrote: |
Using "BLOB" instead of BLOB gives me no syntax error, but I wonder if it's actually working because B returns nothing.
Here is my complete code in my compute node...
Code: |
DECLARE B BLOB;
SET B = InputRoot.BLOB.BLOB; |
|
should work.
Code: |
SET OutputRoot.BLOB = CAST(B AS CHAR ); |
This should be OutputRoot.BLOB.BLOB, you are missing a .BLOB again, however it will not work anyway as the result of the cast is a CHAR (string) which you try placing in a BLOB.
not only that, but the cast of a BLOB to a CHAR is misleading. if input is 'ABC' as a BLOB, output will be a string version of the BLOB : X'414243'
maybe not what would expect.
if you want to change it to the string 'ABC' you should specify the characterset to use. I usually do a
DECLARE STR CHAR;
SET STR = CAST (B AS CHAR CCSID InputRoot.MQMD.CodedCharSetId)
see CCSID in the docs |
|
Back to top |
|
 |
kwelch |
Posted: Thu Sep 12, 2002 5:51 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
lung,
What version of WMQI are you running? We had this problem with 2.01 where the word BLOB always caused a syntax error and were told to just ignore it and our flows worked fine. I notice that our flows don't have the syntax error with 2.1.
Karen |
|
Back to top |
|
 |
wolstek |
Posted: Thu Sep 12, 2002 7:25 am Post subject: |
|
|
Acolyte
Joined: 25 Jun 2001 Posts: 52 Location: Bristol, UK
|
To refer to an earlier part of your question
Quote: |
BLOB"? I will try that. But why is it that we do not need to put quotations when we put MRM or XML? (eg. InputRoot.MRM or InputRoot."MRM" gives no syntax error either way) |
BLOB in V2.0.2 and before was counted as a reserved word because of sataements like CAST(field AS BLOB) whereas in didn't matter with XML/MRM because you couldn't cast to XML or MRM
Interested to learn about this no longer being a problem in V2.1 though somehow I think old habits will be hard to remove. It will always be in double quotes for me. |
|
Back to top |
|
 |
lung |
Posted: Thu Sep 12, 2002 5:31 pm Post subject: |
|
|
 Master
Joined: 27 Aug 2002 Posts: 291 Location: Malaysia
|
That's weird... I'm using 2.1 but it's still giving BLOB (without quotes) as syntax error. Ignoring doesn't seems to work as deployment will give a syntax error warning.
Well, it works when i use "BLOB"... I guess it doesn't really matter anyway.
Thanks  _________________ lung |
|
Back to top |
|
 |
|