End
Use End
to end execution of a routine or subprogram called by Call, Onerrgo, func, or fmet instruction.
End
End EXPRESSION
EXPRESSION
is an expression that is evaluated to return a value (only if End terminates the execution of code called by func or fmet).# Example 1: A subprogram is called
Call COMPUTE(ARRAY(1..20),RESULT)
...
Subprog COMPUTE(ARRAY,RESULT)
Const Integer ARRAY()
Variable Decimal RESULT
RESULT=avg(ARRAY)/1+abs(max(ARRAY))
End : # Returns to the calling routine
# Example 2: A func is called
RESULT=func CLEVER_COMPUTE(ARRAY(1..20))
...
Funprog CLEVER_COMPUTE(ARRAY)
Const Integer ARRAY()
End avg(ARRAY)/1+abs(max(ARRAY))
# Example 3: Error handling routine
Onerrgo ERROR_MANAGEMENT
...
# The code that executes here might be interrupted by an error
...
# ERROR_LIST is supposed to be an array containing the errors code that are considered as minor in the context
$ERROR_MANAGEMENT
If find(errnum,MINOR_ERROR_LIST)
MINOR_ERROR=1
Resume : # Returns to the instruction following the execution that threw an error, MINOR_ERROR is set
Endif
End
End
ends the execution of a script, returning to its caller, which can be a script using Call, func, or fmet instructions.End
ends a handling error routine called by Onerrgo, the procedure in which the error was thrown is ended.End
instruction, a Rollback is automatically performed. This does not happen if the transaction was initiated by the calling routine.No associated errors.
Call, Subprog, Funprog, Trbegin, Commit, Rollback, Onerrgo, fmet, func.