Author |
Message
|
careboy |
Posted: Thu Nov 22, 2012 3:28 am Post subject: ESQL EVAL function question |
|
|
Novice
Joined: 15 Jan 2006 Posts: 10
|
Hi,
Is there a way to execute the following ESQL EVAL function ?
String a = "IF X == '1' THEN SET Y = X+1;"
EVAL(a);
If so, can EVAL supports nested IF statement ?
-Lee |
|
Back to top |
|
 |
Esa |
Posted: Thu Nov 22, 2012 3:51 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
No.
I don't think you can execute invalid ESQL even with EVAL, if that's what you asked. |
|
Back to top |
|
 |
mqsiuser |
Posted: Thu Nov 22, 2012 4:10 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
besides the syntax errors ... from my experience :
EVAL is considered to be slow.
EVAL can fail during runtime, because FUNCTIONS/PROCEDURES used within the EVAL-String are not flattened/'linked in during compile time'/'creation of the bar-file'. Which can lead to problems in production. Since I basically don't use EVAL this is just what a collegue sitting next to me was cursing about once (a production incident because of that something required by EVAL was missing, because it didn't/wasn't linked in during compile).
But that was't (exactly) what you have been asking  _________________ Just use REFERENCEs |
|
Back to top |
|
 |
Esa |
Posted: Thu Nov 22, 2012 5:01 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
@careboy: I think you should review your design. It seems you are trying to make a simple task way too dynamic. |
|
Back to top |
|
 |
kash3338 |
Posted: Thu Nov 22, 2012 9:38 pm Post subject: Re: ESQL EVAL function question |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
careboy wrote: |
Is there a way to execute the following ESQL EVAL function ?
String a = "IF X == '1' THEN SET Y = X+1;"
EVAL(a);
|
Can you please let us know your actual requirement? On seeing this above sample, there is really no use of going for a EVAL function call. |
|
Back to top |
|
 |
careboy |
Posted: Tue Nov 27, 2012 8:07 pm Post subject: |
|
|
Novice
Joined: 15 Jan 2006 Posts: 10
|
It may sounds making a simple solution too complex.
There are 2 parts of statement in the ESQL, i.e. the boolean expression (eg X == 1) and assignment statements (eg Y = X + 1).
We are trying to remove dependencies of flow orchestration logic, whereby the statements, ie. boolean expression is returned from another applications and assignment statements are derived from another external applications. |
|
Back to top |
|
 |
Esa |
Posted: Wed Nov 28, 2012 5:02 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
careboy wrote: |
We are trying to remove dependencies of flow orchestration logic, whereby the statements, ie. boolean expression is returned from another applications and assignment statements are derived from another external applications. |
Sounds like you guys are a bunch of J2EE developers... |
|
Back to top |
|
 |
Esa |
Posted: Thu Nov 29, 2012 1:30 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
No, I'm sorry if that insulted you.
If you were J2EE developers, you would not be asking questions about ESQL. And you would not be asking questions on mqseries.net. You would already have found a set of open source libraries that would help you to externalize the rules for incrementing your loop counters.
Yes, that is what your first example looks like, externalizing the dependencies between loops and their counters. Which is absurd. But as a great fan of Monty Pythons I take special interest in all kinds of absurdities.
Quote: |
We are trying to remove dependencies of flow orchestration logic, whereby the statements, ie. boolean expression is returned from another applications and assignment statements are derived from another external applications. |
Please provide us with a better example. That would greatly help us to take your problem more seriously.
If you are trying to do something like this:
Code: |
'IF flowName = ''A'' ' || ' THEN ' || 'PROPAGATE TO LABEL ''A''' |
it's as absurd as externalizing business logic like this
Code: |
'IF country = ''Finland'' AND date > 1.1.2013' || ' THEN ' || 'SET VAT = 0.24' |
Well, the examples are not absurd as such, they only become absurd if you extract the conditions and the statements from separate sources. That opens a window for the wildest scenarios...
Are you sure you are doing the right thing? |
|
Back to top |
|
 |
|