In an ideal world, the programs you write would run perfectly, and never encounter an error, either software or hardware. In the real world, programs do encounter errors that can result in the premature end of the program's processing. These errors could be caused by something your program does, or they could be beyond your program's control.
MVS™ allows you to provide something called recovery for your programs; that means you can anticipate and possibly recover from software errors that could prematurely end a program. To recover from these errors, you must have one or more user-written routines called recovery routines. The general idea is that, when something goes wrong, you have a recovery routine standing by to take over, fix the problem, and return control to your program so that processing can complete normally; if the problem cannot be fixed, the recovery routine would provide information about what went wrong. If correctly set up, your recovery should, at the very least, provide you with more information about what went wrong with your program than you would have had otherwise.
Part of recovery is also the "cleaning up" of any resources your program might have acquired. By "clean up" of resources, we mean that programs might need to release storage that was obtained, release ENQs, close data sets, and so on. If your program encounters an error before it has the opportunity to clean up resources, either your recovery routine, or another type of user-written routine called a resource manager, can do the clean up. You can also use a resource manager if your program ends normally without encountering any errors.
MVS provides the recovery termination manager (RTM) to handle the process by which recovery routines and resource managers receive control.
Most of this information is devoted to explaining why you might want to provide recovery for your programs in anticipation of encountering one or more errors, and how you go about doing that. An important point to note is that providing recovery is something to be considered at the design stage of your program. You should make the decision about whether to provide recovery before you begin designing the program. Trying to provide recovery for an existing program is much more difficult because recovery must be an integral part of your program.
This information also discusses why you might want to provide resource managers to clean up resources acquired by your program, and how you go about doing that. You can provide resource managers whether or not you provide recovery routines. See Using resource managers for further information.
The following table provides a roadmap to the information in this topic. If you already understand recovery concepts, you might want to skip directly to those topics of specific interest to you.
To find out about: | Consult the following topic: |
---|---|
General recovery concepts, including:
|
Understanding general recovery concepts. |
How to write a recovery routine, including:
|
Writing recovery routines. |
The recovery environment, including:
|
Understanding the recovery environment. |
Coding the various routines in a typical recovery environment. | Understanding recovery through a coded example. |
Advanced recovery topics, including:
|
Understanding advanced recovery topics. |