Ending a check that is coupled with an application

If you write a check that is coupled with an application or product, you should code it so that the check is stopped and deleted when the application shuts down. In this section, we recommend a protocol to do this. Following this protocol is particularly important when IBM® Health Checker for z/OS® is ending at the same time as the application. Our protocol is as follows:
  1. Define a release code for your application in the range X'C00000' to X'FFFFFF' (see Release codes for remote check routines), which you can use to signal a check routine to stop and delete itself.
  2. Code your remote check so that when it receives a DELETE_TERM release code, the check records that fact for use by the process controlling application termination.
  3. When an application begins to terminate and the remote check is already paused after receiving a DELETE_TERM release code, release the check using the application release code defined in Step 1.
  4. When an application begins to terminate and the remote check is not paused by a DELETE_TERM release code, issue the HZSCHECK REQUEST=DELETE service to release the remote check with the DELETE release code.

    It is possible that a timing collision can occur in this process, in which the remote check is just about to be released with DELETE_TERM at the same time that the HZSCHECK REQUEST=DELETE service is issued. In this case, consider using a loop of STIMER or STIMERM invocations to wait in short intervals to see if the DELTE_TERM or DELETE has completed, and continue with application termination when one of those has completed.