|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
'FALSE OR TRUE'. The result was 'FALSE' |
« View previous topic :: View next topic » |
Author |
Message
|
csongebalazs |
Posted: Fri Jan 30, 2004 2:47 am Post subject: 'FALSE OR TRUE'. The result was 'FALSE' |
|
|
Voyager
Joined: 30 Jan 2004 Posts: 78
|
I work with IBM WebSphere MQ Integrator Broker V2.1 for Multiplatforms + CSD05.
In a node there was the following ESQL code:
IF LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHAR), '')) > 10 OR LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHAR), '')) = 0 THEN
SET label = 'mezohiba';
SET Environment.Mezohiba = 'Az id mezo erteke (' || COALESCE(CAST(InputRoot.XML.Root.id AS CHAR), '') || ') nem megfelelo (hossza =0 vagy > 10).';
END IF;
When the InputRoot.XML.Root.id filed was NULL, I saw the following during the user debug trace:
2004-01-30 11:07:31.357000 4420 UserTrace BIP2539I: Node 'PIPE_Huseghitel_folyositas.Kovetkezo_lepes_meghatarozasa': Finished evaluating expression 'LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHARACTER), '')) > 10 OR LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHARACTER), '')) = 0' at (85, 70). This resolved to 'FALSE OR TRUE'. The result was 'FALSE'.
2004-01-30 11:07:31.357000 4420 UserTrace BIP2537I: Node 'PIPE_Huseghitel_folyositas.Kovetkezo_lepes_meghatarozasa': Executing statement 'SET label = 'mezohiba';' at (86, 5).
2004-01-30 11:07:31.357000 4420 UserTrace BIP2537I: Node 'PIPE_Huseghitel_folyositas.Kovetkezo_lepes_meghatarozasa': Executing statement 'SET Environment.Mezohiba = 'Az id mezo erteke (' || COALESCE(CAST(InputRoot.XML.Root.id AS CHARACTER), '') || ') nem megfelelo (hossza =0 vagy > 10).';' at (87, 5).
The first line is VERY INTERESTING !!!
Despite of this, the flow work properly, just the debug file contains this unacceptebale result.
When the InputRoot.XML.Root.id filed was '12345678901', I saw the following in the debug file:
2004-01-30 11:17:10.810000 4420 UserTrace BIP2539I: Node 'PIPE_Huseghitel_folyositas.Kovetkezo_lepes_meghatarozasa': Finished evaluating expression 'LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHARACTER), '')) > 10 OR LENGTH(COALESCE(CAST(InputRoot.XML.Root.id AS CHARACTER), '')) = 0' at (85, 70). This resolved to 'TRUE OR '. The result was 'TRUE'.
It was correct.
Is this a BUG of the user debug trace? |
|
Back to top |
|
 |
JLRowe |
Posted: Fri Jan 30, 2004 7:38 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
It's just a shortcut optimisation performed by the ESQL virtual machine (or whatever it's called). Since the first operand of the OR is TRUE, there is no point evaluating the second.
It'll do the samething with AND, if the first operand is FALSE, it'll skip the evaluation of the second since the result will always be FALSE. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 03, 2004 1:57 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
This resolved to 'FALSE OR TRUE'. The result was 'FALSE'. |
...but 'FALSE OR TRUE' should evaluate to 'TRUE', with or without short-circuit evaluation! |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 03, 2004 6:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Put in more parentheses.
(LENGTH(...)>10 ) OR (LENGTH(...)=0) _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|