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®
- Use only the following characters in label_name: Alphabetic
Numeric
Underscore (_)
Pound sign (#)
At sign (@) - Do not use imbedded blanks in label_name.
- Code a colon after label_name when it identifies the branch point (the start of the subroutine).
- Do not code a colon after label_name when it is a parameter of ONERROR.
- ONERROR detects the failure of the SSPL statement, DIALOG.
- Code ONERROR immediately after the DIALOG statement that may cause an error.
- ONERROR does not provide for return of control.
- 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:
.
.
.