Cancel, Suspend, Resume, Retry
CANCEL, SUSPEND
and RESUME are all handy debugging commands. RETRY is a cousin to
RETURN and is useful in error handlers.
Usage
|
CANCEL
SUSPEND
RESUME
RETRY
|
CANCEL kills program execution on the spot. We use it
most when we're in the middle of debugging and figure out what
the problem is. We cancel the program, go fix the bug and try
again. Some folks use it to end applications, but it's not a
particularly graceful exit—use RETURN instead.SUSPEND and RESUME
let you stop and restart a program. We haven't used SUSPEND much
since the Trace window came along, but, once in a while, it's
handy to be able to arrange for execution to stop at a particular
point. RESUME we use a lot, though it's often from the Debugger
menu. Actually, we're far more likely to press F5 or click on the
green Resume button than to type the command or choose it from
the menu. Regardless of how you issue it, though, RESUME picks up
execution where you left off.RETRY is an interesting command. It
works like RETURN, except that it goes back to the command that
got you there instead of the one after it. Using RETRY where you
shouldn't is a quick ticket to an infinite loop. However, in an
error handler, RETRY is worth a million bucks. You can return to
the statement that caused the error and try the operation again.
This is useful for things like failed locks. You can also use it
for situations where you've fixed the problem in the meantime
(say, by re-creating a missing file).
Example
|
* This program lets you test these commands
WAIT WINDOW "In program. Press a key."
WAIT WINDOW "Type RESUME to go on" NOWAIT
SUSPEND
WAIT WINDOW "Back in program"
DO sub1
WAIT WINDOW "Back from sub1"
RETURN
PROC sub1
* See the difference between Return or Retry
* Enter "E" for Retry or something other than
* "R" to get out immediately.
WAIT WINDOW "(R)eturn or R(e)try" TO cGoOn
DO CASE
CASE UPPER(cGoOn)="R"
RETURN
CASE UPPER(cGoOn)="E"
RETRY
OTHERWISE
CANCEL
ENDCASE
RETURN
|
Back to Table of Contents
Copyright © 2002-2018 by Tamar E. Granor,
Ted Roche, Doug Hennig, and Della Martin. Click for license
.