Describes processing that occurs when the STOP condition is raised. The STOP condition is raised when:
By default, when a STOP condition occurs in a block, all the changes to persistent data (database fields) are undone. If the block is a transaction block, undo variables and temp-table fields are also undone. See OpenEdge Getting Started: ABL Essentials for more information on transaction blocks. The ON STOP phrase can be used to modify the scope of UNDO processing, possibly widening it to an outer block.
Also by default, a STOP condition causes execution to leave the current block. The STOP condition is continually propagated to the outer block, or up the call stack if there is no outer block. The ON STOP phrase can be used to control where execution continues and to clear the STOP condition so that it is not propagated beyond the current block.
The AVM performs stop handling using this precedence, from highest to lowest. The AVM only abides by one of these when a STOP is raised:
Due to this precedence, the ON STOP phrase is ignored if a local CATCH block handles the stop.
ON STOP UNDO [label1] [ , LEAVE [ label2 ] | , NEXT [ label2 ] | , RETRY [ label1 ] | , RETURN [ return-value | ERROR [ return-value | error-object-expression ] | NO-APPLY ] ] |
Because RETRY in a block without user input results in an infinite loop, the AVM automatically checks for this possibility and converts a RETRY block into a LEAVE block, or a NEXT block if it is an iterating block. This behavior is often referred to as infinite loop protection.
Option | Description |
return-value | In procedures and VOID methods, this must be a CHARACTER string. The caller can use the RETURN-VALUE function to read the returned value. For user-defined functions, non-VOID methods and property getters, the value must match the specified return type. |
ERROR | Undoes the current subtransaction, and raises ERROR in the caller. You cannot specify ERROR within a user-interface trigger block or a
destructor. For user-defined functions see note below. |
ERROR return-value | Undoes the current subtransaction, and raises ERROR in the caller. The CHARACTER string you
provide is available to the caller in the RETURN-VALUE function. The AVM also creates an AppError object and stores the return-value in the ReturnValue property. For user-defined functions see note below. |
ERROR error-object-expression | Undoes the current subtransaction, and raises ERROR in the caller. The specified error object
instance is thrown to the caller. For user-defined functions see note below. |
NO-APPLY | In a user-interface trigger, prevents the AVM from performing the default behavior for the trigger event. Otherwise, the option is ignored. |
This procedure lets you update the CreditLimit field for each Customer. If you enter a value greater than 100,000, the program raises the STOP condition. Since you specified an UNDO, RETRY for a STOP, the procedure starts the iteration over and allows you to enter another value.
r-ostop.p