Problem:
Net Express Dialog System Interrupting loops within Dialog.
A Micro Focus COBOL application is using Dialog to display a counter. The Dialog panel displaying the counter has an interrupt button but this does not appear to take effect until the count is complete.
The COBOL program executes a Dialog procedure, which refreshes the counter and returns control to the calling program. The interrupt button does not work because Dialog is never given control to process any user events. The loop returns directly to the COBOL program once the Dialog functions have been executed.
Resolution:
Alter the loop so that Dialog, having updated the counter, is given the opportunity to detect any user events. This is achieved by implementing a TIMEOUT, giving the user 1/100<SUP>th</SUP> of a second to interrupt the loop.
When the interrupt button is pressed, the LOOP-INTERRUPTED procedure is executed, disabling the TIMEOUT. This prevents control returning to the COBOL program.
The following demonstrates how to code the Dialog loop, UPDATE-COUNTER, which is called from COBOL.
UPDATE-COUNTER
* Loop-Counter is a display field that holds the counter
REFRESH-OBJECT LOOP-COUNTER
TIMEOUT 1 RETURN-TO-LOOP
RETURN-TO-LOOP
RETC
LOOP-INTERRUPTED
TIMEOUT 0 $NULL
If no user event occurs, then RETURN-TO-LOOP returns control
to the COBOL program.
Summary:
Use TIMEOUTs to release control to Dialog when processing
loops from a COBOL program.
Notes:
N/A
Keywords/Phrases:
Net Express, Dialog, Interrupt, Loop, Timeout
