Interrupting Commands

Interrupting Commands

Top  Previous  Next

 

It may be necessary to terminate a command because, perhaps, it is producing more output than expected or it is not functioning as required. The break key (usually ctrl-C) can be used to terminate processing and return to the command prompt.

 

To protect against accidental use of the break key, QM will display a prompt asking for confirmation that processing is to be terminated. Valid responses to this prompt are

AAbort. Returns to the command prompt in exactly the same way as an abort generated by an ABORT statement in a QMBasic program or an ABORT command in a paragraph. The ON.ABORT paragraph is executed, if present. The @ABORT.CODE variable will be set to 1. The default select list (list 0) will be cleared if it was active.
DOnly offered when appropriate, this option enters the QMBasic debugger.
GGo. Continues processing from where it was interrupted. If the terminal supports the necessary operations, QM will restore the display image to remove the prompt.
PCreates a process dump file and continues execution.
QQuit. Returns from the current command to the paragraph, menu, program or command prompt that initiated the command. The ON.ABORT paragraph is not executed. The @ABORT.CODE variable will be set to 2. The default select list (list 0) is not cleared.
SStack. Displays the call stack showing the program name and location for each entry.
WWhere. Displays the current program name and location.
XExit. Aborts totally from QM without executing the ON.EXIT paragraph. This option should only be used if QM appears to be behaving incorrectly.
?Help. Displays a brief explanatory help text for each option.

 

The break key is initially disabled on entry to QM but it is enabled after execution of the optional QMSYS MASTER.LOGIN paragraph and LOGIN VOC item.  It is often left disabled in application software so that users cannot gain access to the command environment. Developers usually need the break key enabled and this can be done using the BREAK command or the corresponding QMBasic BREAK statement.

 

QMBasic programs can establish a break handler to catch use of the break key and take special action. See the SET.BREAK.HANDLER statement for details.