September 12, 2006, 12:15 PM
mgrackinPrarie,
You use .EVAL when you want FOCUS to parse the value of the &varbiable after it resolves the variable. The examples in the documentation show that the &variable is set to a dialogue manager keyword such as -TYPE or -*. If the .EVAL is not used, FOCUS does not treat the -TYPE or -* as a dialogue manager command. Rather, it will treat it as a literal value.
Another example would be mathematical symbols * / + or -.
-SET &EXP = '*';
-SET &RES = 3 &EXP 5;
The above will not work because FOCUS won't know the value for &EXP is a multiplication sign as ossposed to just an asterisk.
The following will give you the desired result.
-SET &RES = 3 &EXP.EVAL 5;
The above would give you 15.
September 12, 2006, 12:21 PM
KevinGPrarie,
I'm not sure there is a rule defined by IBI, but we do not use .EVAL in comparison operations (EQ,GT,LT, etc.). We do use the .EVAL operator to insert the value of an &var as we are dynamically building code (ie SQL passthru) strings.
Also particularly useful for dynamically commenting out lines of code (for instance setting an &var to -* depending on parameters, where the &var.EVAL starts in column 1)
I have seem the .EVAL operator used in comparisons and it seems to work most of the time, but as I run accross those in code maintenance, I replace them according to the rule above.
Hope this helps,
Kevin
September 12, 2006, 01:48 PM
PrarieThanks for the insight.