ONERROR

Branches if a call to a dialog fails.

Type

Control structure or branching statement

Format

ONERROR label_name . . . [label_name:]
label_name
The 1- to 255-character label name of the section of the dialog that will receive control.
label_name:
The 1- to 255-character label name of the section of the dialog that will receive control if you have an error; this identifies the start of the subroutine.

Usage Notes®

  1. Use only the following characters in label_name:
    Alphabetic
    Numeric
    Underscore (_)
    Pound sign (#)
    At sign (@)
  2. Do not use imbedded blanks in label_name.
  3. Code a colon after label_name when it identifies the branch point (the start of the subroutine).
  4. Do not code a colon after label_name when it is a parameter of ONERROR.
  5. ONERROR detects the failure of the SSPL statement, DIALOG.
  6. Code ONERROR immediately after the DIALOG statement that may cause an error.
  7. ONERROR does not provide for return of control.
  8. ONERROR operates only within a dialog section; for example, you cannot branch to the EPILOGUE from an ONERROR in the PROLOGUE.

Example

ONERROR branches to eproc if dialog nextr fails:

       dialog nextr
       onerror eproc
  .
  . 
  .
eproc:
  .
  . 
  .

See Also

DIALOG

PASS

SELECT

TIMEOUT