The following example shows a simple error trap that you can use in many programs:
| /* Here is a sample "main program" with an error */ |
| signal on error /* enable error handling */ |
| "ersae myfiles.*" /* mistyped "erase" instruction */ |
| exit |
| /* And here is a fairly generic error handler for this */ |
| /* program (and many others...) */ |
| error: |
| say "error" rc "in system call." |
| say |
| say "line number =" sigl |
| say "instruction = " sourceline(sigl) |
| exit |