Consultor Eletrônico



Kbase P101879: How to interrupt a long 4GL job without using any PROCESS EVENT?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/03/2005
Status: Unverified

GOAL:

How to interrupt a long 4GL job without using any PROCESS EVENT?

FACT(s) (Environment):

Progress 9
OpenEdge 10

FIX:

It is possible to trap a a STOP condition in a DO block as shown in the code bellow. Note that the STOP condition can be raised by pressing Ctrl-Break (control key + Pause/Break Key usually present on any PC keyboard at the top right corner) or with Ctrl-C on *NIX.
ON 'CHOOSE' OF myButton DO:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.

DO ON STOP UNDO, RETRY:
IF RETRY THEN DO:
/* This block is a perfect place to do some clean up, especially for NO-UNDO resources */
MESSAGE "Stop was pressed (Ctrl-Break)" SKIP
"About to interrupt the job"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
RETURN.
END.

/*This is just an example to simulate a long job that can be interrupted by ctrl-break*/
DO n = 1 TO 10:
FOR EACH orderline NO-LOCK:
i = i + 1.
END.
END.
MESSAGE i VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
END.