System Functions
EVN( ) Evaluate Numeric Expression
   
Format 1. Evaluate numeric string expression: EVN( var$ [ , val ] [,ERR=stmtref])
2.
Evaluate numeric expression: EVN( =numexpr [ , val ] [,ERR=stmtref])

Where:

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.
For instance, PRINT EVN("40/0",0) would return val=0 rather than generating Error #40: Divide check or numeric overflow.
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, as in the example below.
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 Returns the value of the evaluated numeric expression.
   
Format 1 This format of the EVN( ) function 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 with by the ERR= option.

If the default value (val) is supplied, it will be returned if the expression results in an error.

   
Format 2 This format of the EVN( ) function simply returns the value of the expression supplied in numexpr. This format is used when you have a constant expression but want to place an error trap around the expression.

If the default value (val) is supplied, it will be returned if the expression results in an error. If no default value is supplied and an error occurs, the ERR= trap will be taken.

This format of EVN function is +PxPlus Exclusive (build 9200)

   
See Also EVS( ) Evaluate String Expression
VIS( ) function and VIN( ) function - obtain value of variable
   
Examples In this example, EVN("GL_"+X$) builds the variable name based on user input and returns the value stored in the variable.
 
00010 GL_YTD=10000,GL_MTD=3000,GL_CUR=10
00020 input "Which field (YTD,MTD,CUR):",X$
00030 print evn("GL_"+X$):"$###,##0.00-"
00040 stop
 
For the example above, 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, ProvideX prints that value (using the format mask) as $9,999.63.
In this 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