Programming notes

  1. All data used by a routine that is to operate in the must-complete mode should be checked for validity to ensure against a program-check interruption.
  2. If a routine that is already in the must-complete mode calls another routine, the called routine also operates in the must-complete mode. An internal count is maintained of the number of SMC requests; an equivalent number of RMC requests is required to reset the must-complete function.
  3. Interlock conditions can arise with the use of the ENQ function. Additionally, an interlock might occur if a routine issues an ENQ macro while in the must complete mode. Also, a task that is non-dispatchable, because of a must-complete request, might already be queued on the requested resource. In this case, an enabled wait occurs. An enabled wait can be broken by an operator's action (such as the use of the FORCE command).
  4. There are some considerations to be aware of when using enclaves for tasks that serialize resources using the ENQ macro. For details, see “Using ENQ/DEQ or Latch Manager Services With Enclaves” in z/OS MVS Programming: Workload Management Services.
  5. The macros ATTACH, ATTACHX, LINK, LINKX, LOAD, XCTL, and XCTLX should not be used (unless extreme care is taken) by a routine operating in the must-complete mode. An interlock condition results if a serially reusable routine requested by one of these macros either has been requested by one of the tasks made non-dispatchable by the use of the SMC parameter or was requested by another task and has been only partially fetched.
  6. The time a routine is in the must-complete mode should be kept as short as possible -- enter at the last moment and leave as soon as possible. One suggested way is to:
    1. ENQ (on desired resource(s))
    2. ENQ (on same resource(s)),RET=HAVE,SMC=STEP

    Step (a) gets the resource(s) without putting the routine into the must-complete mode. Later, when appropriate, issue the ENQ with the must-complete request (Step b). Issue a DEQ macro to terminate the must complete mode as soon as processing is finished. Tasks set non-dispatchable by the corresponding ENQ macro are made dispatchable and asynchronous exits from the requesting task are enabled.