Author |
Message
|
schroederms |
Posted: Thu Jan 20, 2005 1:57 pm Post subject: WBI migration question on EVAL statement |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Did something change in the EVAL from 2.1 to version 5 ?
We have some code a IBM consultant wrote for us in version 2.1 and has a syntax error now that looks OK to me based on what I've read on EVAL on the HELP of version 5. His code was buried in a ton of other code, so I pulled it out and put it into a Testing compute node to see if I can recreate it there, and I can.
No matter what statement I type that is now in red, is an error, so it looks like it maybe the previous EVAL statement. I could code DECLARE ABC CHARACTER; and it errors out. Code below.
Thanks.
CREATE COMPUTE MODULE Testing_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- Error number extracted from exception list
DECLARE Error CHARACTER;
-- Error Text extracted from the exceptionlist
DECLARE ErrorText CHARACTER;
-- Current path within the exception list
DECLARE Path CHARACTER;
-- Start at first child of exception list
SET Path = 'InputExceptionList.*[1]';
-- Loop until no more children for the Error number
WHILE EVAL( 'FIELDNAME(' || Path || ') IS NOT NULL' ) DO
-- Check if error number is available
IF EVAL( 'FIELDNAME(' || Path || '.Number) IS NOT NULL' ) THEN
-- Remember only the deepest error number
SET Error = EVAL( Path ||'.Number');
END IF;
SET Path = Path || '.*[<]';
END WHILE; -- End loop
RETURN TRUE;
END;
END MODULE; |
|
Back to top |
|
 |
JT |
Posted: Thu Jan 20, 2005 2:30 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
....and has a syntax error now.... |
What is the exact text of the synatx error? |
|
Back to top |
|
 |
JT |
Posted: Thu Jan 20, 2005 2:51 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
The only major difference between the code your IBM consultant provided, and the example in the ESQL Reference manual (pg. 159) is the declaration of the Error variable. The example in the v2.1 & v5.0 manuals declare the variable as an INTEGER, not CHARACTER.
Was this changed at some point? |
|
Back to top |
|
 |
schroederms |
Posted: Thu Jan 20, 2005 2:52 pm Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
All it says within the ToolKit in the task list is:
"Syntax error." line 21
Not much to go off of. |
|
Back to top |
|
 |
JT |
Posted: Thu Jan 20, 2005 2:56 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Then, see if adding a space after the logical operator helps:
Code: |
SET Error = EVAL( Path || '.Number'); |
|
|
Back to top |
|
 |
schroederms |
Posted: Thu Jan 20, 2005 2:57 pm Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
The only major difference between the code your IBM consultant provided, and the example in the ESQL Reference manual (pg. 159) is the declaration of the Error variable. The example in the v2.1 & v5.0 manuals declare the variable as an INTEGER, not CHARACTER.
Was this changed at some point?
No, I just mnigrated it today. I've printed off both v2.1 and v5 and they are the exact same with the exception of me changing:
SET Path = Path || '.*[LAST]' to
SET Path = Path || '.*[<] based on the compiler message stating the 'LAST' has been deprecated. |
|
Back to top |
|
 |
schroederms |
Posted: Thu Jan 20, 2005 3:00 pm Post subject: |
|
|
 Disciple
Joined: 21 Jul 2003 Posts: 169 Location: IA
|
Then, see if adding a space after the logical operator helps:
Nope tried that too earlier today. What is weird you can replace that statment with:
DECLARE WHATTHECRAP CHARACTER;
and it too will error out. It's almost like the statement:
IF EVAL( 'FIELDNAME(' || Path || '.Number) IS NOT NULL' ) THEN
is causing it. |
|
Back to top |
|
 |
JT |
Posted: Fri Jan 21, 2005 6:45 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
|
Back to top |
|
 |
|