| Introduction | MTB Statements | File System | Compiler | Applications | Reference Guide | Index |
| Language Structure | Data Division | I/O Format Division | Procedure Division | Mnemonics |
| Syntax: | AGAIN |
| Discussion: |
The AGAIN statement causes Comet to retry the last exception-producing
action.
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. |
| Example: |
OPEN (2) "LP1",In 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). |