EVN( ) |
Evaluate Numeric Expression |
1. |
EVN(var$ [ ,val ] [,ERR=stmtref]) |
The following was added in PxPlus v9.00:
2. |
EVN(=numexpr [ ,val ] [,ERR=stmtref]) |
val |
Default value to be returned if the evaluation fails at run time (with any error except a syntactical error). If supplied, the error will be ignored and the value will be returned instead. Example: |
var$ |
String expression containing numeric variable name. Maximum string size 8KB. Receives the returned evaluated contents of the variable. You can build the variable name using string expressions (see Example). |
numexpr |
Numeric expression to be processed and whose value will be returned by the EVN function. |
stmtref |
Program line number or statement label to which to transfer control. |
Returns the value of the evaluated numeric expression.
EVN(var$ [ ,val ] [,ERR=stmtref])
This format evaluates and returns the numeric value of a numeric variable or computed expression. Use this function to process a stored or computed expression and obtain its current value. Any error (syntax or run-time error) will be trapped by the function and can be processed by the ERR= option.
If the default value (val) is supplied, it will be returned if the expression results in an error.
EVN(=numexpr [ ,val ] [,ERR=stmtref])
This format simply returns the value of the expression supplied in numexpr. 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 EVN function was added in PxPlus v9.00.)
EVS( ) Evaluate String Expression
VIN( ) / VIS( ) Obtain Value of Variable
In this example, evn("GL_"+X$) builds the variable name based on user input and returns the value stored in the variable:
0010 GL_YTD=10000,GL_MTD=3000,GL_CUR=10
0020 input "Which field (YTD,MTD,CUR):",X$
0030 print evn("GL_"+X$):"$###,##0.00-"
0040 stop
If the user's input is CUR for X$, the variable name will be GL_CUR. If the value stored in GL_CUR in the current record is, for example, 9999.63, the system prints that value (using the format mask) as $9,999.63.
In this next example, evn(V$) will print the numeric value stored in V$ for the current record of logical file number RPT_FN:
0090 K$=key(RPT_FN); if K$(1,12)<>RPT_ID RETURN
0100 read (RPT_FN)L,C,V$
0110 print (RPT_FN) @(C,L),evn(V$)
0120 goto 0090