Comet 32 Runtime
The AGAIN statement causes Comet to retry the last exception-producing
Execution of the AGAIN statement transfers program control to the last statement that resulted in an exception branch. If no exception-producing action occurred, control is returned to the first Procedure Division statement in the program.
Note: You cannot nest error routines and expect multiple returns to any error-producing commands other than the most recent occurrence.
|History:||Starting with Build 312, if a program executes an AGAIN statement and the previous error was an EXCP 33, Comet will pause 1/2 second before giving the program control again. This is to prevent a possible system lock-up.|
OPEN (2) "LP1",EXCP=PRTREXCP . . . PRTREXCP: IF EXCP NE 31 THEN ERROR PRINT (0) "PRINTER UNAVAILABLE." PRINT (0) "PRESS TAB WHEN READY." INPUT (0) "" AGAINIn this example, the program attempts to open printer "LP1" on logical unit number 2. If this statement produces an exception, the program branches to label PRTREXCP, an exception handling routine.
The routine first checks the system exception variable EXCP and if it equals anything other than 31 (i.e., DEVICE OR DIRECTORY UNAVAILABLE), aborts the program with the ERROR statement.
However, if EXCP equals 31, the program displays a message on the terminal, waits for input (using the dummy input statement), and then retries the last exception-producing action (in this case, the OPEN statement).