#COMPILE EXE "s81_on_error.exe"
' Sample: ON ERROR basic error handling
FUNCTION PBMAIN() AS LONG
    ON ERROR GOTO ErrHandler
    PRINT "Normal execution"
    PRINT "No error occurred"
    GOTO Done
ErrHandler:
    PRINT "Error occurred! ERR ="; ERR
    RESUME NEXT
Done:
    FUNCTION = 0
END FUNCTION
