ProvideX V8.20 > Language Reference > 3. System Functions
425
ERR( ) Function
        Test Error Value
Format
1. Return ERR Position: ERR(compare1,compare2,...[,ERR=stmtref])
2. Return Extended Error Information: ERR(keyword$ | *)
Where:
*
Asterisk. Lists the names of the returned values.
compare1,
Comma-separated list of numeric values for comparison with the
compare2, ...   value of the internal ERR variable.
keyword$
Currently supported return values:
"ERR" Error condition
"RET" OS error
"OSERR" OS error message; i.e., MSG(-1)
"PROGRAM" Pathname of program with error
"STNO" Statement number
"OBJ" Object number
"METHOD" Method name invoked
"LFA" Last file accessed
"LFO" Last file opened
"LASTPATH" Last pathname referenced
"LASTKEY" Record key value, only valid for Error 11's.
stmtref
Program line number or label to transfer control to.
Returns
Integer, relative position if match found, 0 zero if no match found.
Description
The ERR( ) function can be used to determine the value of the internal ERR variable
or receive additional information about the last un-trapped error.
Format 1: Return ERR Position
ERR(compare_1,compare_2,...compare_n[,ERR=stmtref])
Use this format to compare the value of the internal ERR variable with a list of
possible external error values. If a match is found, the function returns an integer
reporting the relative position of the value which matches the value in the external
ERR system variable. The function returns 0 zero if no match is found.
Example:
0040 ON ERR(1,11,2) GOTO 1000,1010,1110,1020
Possible results:
Control transfers to line 1010
ERR=1
Control transfers to line 1110
ERR=11
Control transfers to line 1020
ERR=2
No match. Control transfers to line 1000.
ERR=0