Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Programming rules for exit routines

&pagelevel(4)&pagelevel

Exit routines, like the system components calling them, always run in the privileged state. Special care should therefore be taken in programming them. The use of TU macros, in particular, or other programming errors may result in the abortion of a task or even in a system crash. Errors in exit routines are treated like system errors. The following rules and restrictions should be observed at all costs:

  • Exit routines must include AMODE ANY and RMODE ANY in the XS environment and they must adhere to programming regulations (cf. “Programming example”).

  • Exit routines must be programmed reentrant and read-only.

  • The CSECT/ENTRY name of an exit routine is freely selectable. CSECT/ENTRY names used must be unique throughout the system.

  • Any problems arising from call nesting, parallel usage or recursion must be taken care of by the exit routine itself (cf. programming example).

  • If both a TU SVC and a privileged interface (e.g. REQM, $REQM) exist for a function, the exit routine must use the privileged call.
    Exception: PRNT, cf. note on the spoolout exit.

  • Fields marked “unused” or “reserved” in the system tables (see appendix) must not be used by the exit routines. If the exit routine requires task or job information, use of the $TINF, $RDUID, $JINBAS, $JINTSK and JOBINFO macros is strongly recommended. With the aid of these macros the appropriate information can be retrieved or requested from the exit routine’s own parameter areas without any problems.

  • Privileged machine instructions cannot be used.

  • The exit routine must not be used for system tasks (interrupt-driven tasks); interrogate the appropriate bit in the TCB via $EZOTYP.

  • When processing a file in an exit routine, any file that has been opened must also be closed by the same routine, otherwise problems may arise.

  • Exit routines run in privileged state TPR (Task PRivileged, previously P2). Exit routines can employ privileged system interfaces at the user’s risk.

  • Exit routines are activated at a time when no “lock” state exists in the system.

  • Exit routines may use the TPR floating-point registers, provided their contents are saved before use and reloaded afterwards.

  • When using macros that use the encapsulation macros ## BAL and ## BALR, these must be redirected to BAS or BASR with the assembler instruction OPSYN.