EVS( ) |
Evaluate String Expression |
1. |
EVS(var$ [ ,val$ ] [,ERR=stmtref]) |
The following was added in PxPlus v9.00:
2. |
EVS(=strexpr [ ,val$] [,ERR=stmtref]) |
val$ |
Value to be returned if the evaluation fails at run time (with any error except a syntactical error). Optional. If you include a value, the error will be ignored and the value will be returned instead. A=9999; This would display the value <Overflow> rather than generate an Error #43: Format mask invalid. |
var$ |
String variable name. Receives the returned evaluated contents of the variable. You can build the variable name using string expressions (see Example). |
strexpr |
String expression to be processed and whose value will be returned by the EVS function. |
stmtref |
Program line number or statement label to which to transfer control. |
Evaluated contents of string variable.
EVS(var$ [ ,val$ ] [,ERR=stmtref])
This format evaluates and returns the value (evaluated contents) of a string variable.
EVS(=strexpr [ ,val$] [,ERR=stmtref])
This format simply returns the value of the expression supplied in strexpr. You can use this format when you have a constant expression that you need to place an error trap around (e.g. an expression that includes a reference to an object method or function that you do not know if it exists).
(The ability to pass an expression to the EVS function was added in PxPlus v9.00.)
EVN( ) Evaluate Numeric Expression
VIN( ) / VIS( ) Obtain Value of Variable
In this example, EVS( ) builds the string variable's field name ("CST_"+X$+"$") based on the user's input and returns the value stored in it:
CST_NAME$=who,CST_ADDR$="8920 Woodbine Avenue"
CST_CITY$="Markham",CST_CONTACT$="Support"
input "Which field (NAME,ADDR,CITY,CONTACT):",X$
print evs("CST_"+X$+"$")
stop
If the user's input for X$ is ADDR, the variable name will be CST_ADDR$. The value in evs(CST_ADDR$) for the current record could be 8920 Woodbine Avenue, which is what the system would return and then print.