Author |
Message
|
scravr |
Posted: Wed Apr 06, 2011 1:02 pm Post subject: WMB 7 - EVAL function |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
Puting these lines into EVAL function always get following error
This is the string to EVAL:
If (CfgSrvRef.SubscriberId = 'RCDC02_CASH_PAYMENT_V100') Then
Return True;
Else Return False;
End If;
This is the error I am getting.
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbRdl\ImbRdlRdp.cpp
Line:INTEGER:355
Function:CHARACTER:SqlParser::parseExpression
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:TestFilter#FCMComposite_1_8
Label:CHARACTER:TestFilter.Compute
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2402
Text:CHARACTER:Expected end of file
Insert
Type:INTEGER:5
Text:CHARACTER:
Insert
Type:INTEGER:5
Text:CHARACTER:2.5
Insert
Type:INTEGER:5
Text:CHARACTER:keyword Then
same error when I put the "Then" on second line like:
If (CfgSrvRef.SubscriberId = 'RCDC02_CASH_PAYMENT_V100')
Then
...
...
...
Can EVAL work with "Then" ? |
|
Back to top |
|
 |
mgk |
Posted: Wed Apr 06, 2011 1:51 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
First, are you aware there are two versions of EVAL? The first is the EVAL function, which can only "evaluate" expressions, and the EVAL statement which can only "evaluate" one or more statements. In this case it would appear you need to be using the statement version. If you are, can you post the actual ESQL that contains the EVAL please...
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
MrSmith |
Posted: Thu Apr 07, 2011 2:14 am Post subject: |
|
|
 Master
Joined: 20 Mar 2008 Posts: 215
|
could you also add what node you are doing the evaluation in as your syntax may be incorrect for that particular node (i.e filter v compute) |
|
Back to top |
|
 |
scravr |
Posted: Thu Apr 07, 2011 4:31 am Post subject: |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
This is on 7.0.0.1
In ESQL Compute node: the following 4 ESQL lines are SELECT from a database into Env. Var. named CfgSrvRef.FilterCode:
If (CfgSrvRef.SubscriberId = 'RCDC02_CASH_PAYMENT_V100') Then
Return True;
Else Return False;
End If;
Then if we got something from DB, we EVAL the lines and like to get True or False:
...
...
...
Declare rtVal Boolean False;
...
...
...
IF CfgSrvRef.FilterCode IS NOT NULL THEN
Set rtVal = EVAL(CfgSrvRef.FilterCode);
If (rtVal = False) Then -- this may neve execute since we already return in EVAL
Return False;
End If;
END IF;
...
...
...
Return True;
This is the error I am getting.
RecoverableException
File:CHARACTER:F:\build\S700_P\src\DataFlowEngine\ImbRdl\ImbRdlRdp.cpp
Line:INTEGER:355
Function:CHARACTER:SqlParser::parseExpression
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:TestFilter#FCMComposite_1_8
Label:CHARACTER:TestFilter.Compute
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2402
Text:CHARACTER:Expected end of file
Insert
Type:INTEGER:5
Text:CHARACTER:
Insert
Type:INTEGER:5
Text:CHARACTER:2.5
Insert
Type:INTEGER:5
Text:CHARACTER:keyword Then |
|
Back to top |
|
 |
mgk |
Posted: Thu Apr 07, 2011 5:24 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
So code uses the EVAL function:
Code: |
Set rtVal = EVAL(CfgSrvRef.FilterCode); |
But the code you are EVALing is a statement (IF) so you must use the EVAL statement, which does not return a value like this:
Code: |
EVAL(CfgSrvRef.FilterCode); |
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
gechu |
Posted: Wed May 25, 2011 6:43 am Post subject: |
|
|
Apprentice
Joined: 27 Feb 2008 Posts: 48
|
I´m stuck here as well.
The function transportVIDB returns a boolean.
Code: |
-- dummy code to force the compiler to include a function which only will be run via an EVAL function..
IF (FALSE) THEN CALL transportVIDB(InputLocalEnvironment, InputLocalEnvironment) INTO InputLocalEnvironment.temp; END IF;
DECLARE functionStr CHARACTER 'CALL ' || transportAfterMQ || '(messageListMsgRef, InputLocalEnvironment)';
--> CALL transportVIDB(messageListMsgRef, InputLocalEnvironment);
DECLARE myBooleanVar BOOLEAN;
SET myBooleanVar = EVAL(functionStr);
|
I get the same error: Expected end of file.
I´ve read that EVAL can only return a single scalar value representable in character. A boolean value I assume fits that description.
Why does this code above fail?
Thanks! |
|
Back to top |
|
 |
gechu |
Posted: Wed May 25, 2011 6:50 am Post subject: |
|
|
Apprentice
Joined: 27 Feb 2008 Posts: 48
|
Found the answer myself.
when I call my function using EVAL I should not include the "CALL" part in the code. Here is a BAD example:
DECLARE myBool = EVAL('CALL myFunction(param)');
and the good one:
DECLARE myBool = EVAL('myFunction(param)');
Didn´t try the code, but I hope you get the point.
/Erik |
|
Back to top |
|
 |
|