Progress
Language Reference
UNDO Statement
Backs out all modifications to fields and variables made during the current iteration of a block, and indicates what action to take next.
SYNTAX
label1
The 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, Progress disregards DO ON ENDKEY blocks that do not have the ON ERROR or TRANSACTION option.
LEAVE label2
Indicates that after undoing the processing of a block, Progress leaves the block you name with label2. If you do not name a block with the LEAVE option, Progress leaves the block that was undone. After leaving a block, Progress continues on with any remaining processing in a procedure.
NEXT label2
Indicates that after undoing the processing of a block, Progress does the next iteration of the block you name with label2. If you do not name a block, Progress does the next iteration of the block that was undone.
RETRY label1
Indicates that after undoing the processing of a block, Progress 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.
RETRY is the default processing if you do not use LEAVE, NEXT, RETRY, or RETURN. When a block is retried, any frames scoped to that block are not advanced or cleared. For more information, see the Progress Programming Handbook .
RETURN [ ERROR | NO-APPLY ]
Returns to the calling procedure or to the Progress Editor (if there was no calling procedure). You can specify NO-APPLY within a user-interface trigger to prevent Progress from doing anymore handling for the event. In other contexts, you can use the ERROR option to raise the ERROR condition in the caller.
return-value
You can use return-value to return a value to the caller.
EXAMPLEThe
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.
NOTES
- You can also specify UNDO processing for a block by using the ON ERROR and ON ENDKEY phrases with a block statement.
- An UNDO statement that specifies a block that encompasses the current system transaction block has no effect on changes made prior to the start of the system transaction. This includes changes made to variables prior to the beginning of the system transaction.
- If nothing changes during a RETRY of a block, then the RETRY is treated as a NEXT or a LEAVE. This default action provides protection against infinite loops.
- For more information on the UNDO statement, see the Progress Programming Handbook .
SEE ALSO
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |