UNDOlabel, LEAVE label2, NEXT label2, RETRY label1, RETURN return-valueERROR return-value error-object-expressionNO-APPLY, THROW error-object-expressionThe name of the block whose processing you want to undo. If you do not name a block with label1, UNDO undoes the processing of the closest transaction or subtransaction block. In determining the closest transaction or subtransaction block, the AVM disregards DO ON ENDKEY blocks that do not have the ON ERROR or TRANSACTION option.LEAVE label2Indicates that after undoing the processing of a block, the AVM leaves the block you name with label2. If you do not name a block with the LEAVE option, the AVM leaves the block that was undone. After leaving a block, the AVM continues on with any remaining processing in a routine.NEXT label2Indicates that after undoing the processing of a block, the AVM does the next iteration of the block you name with label2. If you do not name a block, the AVM does the next iteration of the block that was undone.RETRY label1Indicates that after undoing the processing of a block, the AVM repeats the same iteration of the block you name with label1. If you name a block with label1 it must be the name of the block that was undone.
return-value
ERROR ERROR return-value The AVM also creates an Progress.Lang.AppError object and stores the return-value in the ReturnValue property. ERROR error-object-expression The specified error object is created and populated according to your code. If this is an Progress.Lang.AppError object, the caller can use the RETURN-VALUE function to read the setting of the ReturnValue property. NO-APPLY THROW error-object-expressionThe THROW directive stops the execution of the current block of ABL code, or the current iteration of an ABL iterating block, and raises the error type specified in error-object-expression. The value of error-object-expression is an error object.In this example, the THROW directive creates an instance of Progress.Lang.AppError using one of the default object constructors:
UNDO, THROW NEW Progress.Lang.AppError("Can't find this customer", 550)You can only THROW error objects, and an error object is an object derived from the built-in interface Progress.Lang.Error. It is a compile-time error to THROW an object that is not derived from Progress.Lang.Error.
The UNDO, THROW statement can itself raise error or THROW a Progress.Lang.SysError object if it fails. For example, if the statement cannot find the specified error object. In this case, the SysError will be trapped by the same block that would have trapped the successfully thrown error object.ExamplesThe r-undo.p procedure prompts you for the initials of a sales representative. If the initials match those of an existing sales representative, the procedure displays that sales representative’s record. Otherwise, it prompts you to add another sales representative with the initials you supplied. If you enter no, the UNDO statement undoes the work you have done since the start of the REPEAT block and lets you enter another set of initials.
For more information on the UNDO statement, see OpenEdge Getting Started: ABL Essentials.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |