Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

Termination exits (001/002)

&pagelevel(3)&pagelevel

An exit routine can be connected before or after program termination or before task termination.

At the termination request exit control is transferred to the appropriate exit routine before program or task termination (TERM, ABEND, LOGOFF).

At the termination return exit an exit routine is called after a program has ended.

The exit routines can:

  • write their own account files

  • carry out housekeeping routines

  • analyze the global storage area (SYSVECT)

  • modify a /LOGOFF/ABEND operand (in the case of task termination).

Request exit (001)

The following information is passed to the exit routine:

R1 = A($TERMRF parameter area)
R12 = A(TPR program manager)
R13 = A(save area of calling component)
R14 = A(indirect return)
R15 = A(exit routine)

Return exit (002)

The following information is passed to the exit routine:

R1 = A($TERMRF parameter area)
R12 = A(TPR program manager)
R13 = A(save area of calling component)
R14 = A(indirect return)
R15 = A(exit routine)

The return code for the calling system component must be stored in the ENRTMRET field of the parameter area.

Notes

  • General

    The contents of registers 12, 13 and 14 must not be destroyed by the exit routine.

    Calls which lead to further termination processing, e.g. EXEC, LOAD, TERM and $TERM, are illegal.

    It is not possible to reset or abort termination processing.

    The macro TYPIO (with request for an operator response) and CLOSE ALL should not be used in the exit routine.

    If accounting data is being written to the exit routines, the exits should not be deactivated before shutdown as long as user tasks are still present in the system. As shutdown leads to forced task termination, data could be lost.

  • File processing

    Files which are managed by exit routines must be created in the system with the operand USER-ACCESS=*ALL-USERS under any user ID. This is because program and task termination are executed under the control of the task in question and therefore of the corresponding user ID. Thus the files must be accessible by all user IDs.

    For the files managed by exit routines all EXLST exits must be made available. Otherwise there is a danger with a request for program termination that the user program will be terminated with the DMS error code of the exit routine.

    The exit routine itself is responsible for the correct closing of files opened in the exit routine.

  • Task termination

    The contents of the ENRTLGFC field in the $TERMRF parameter area (which the user can modify) are taken over, provided its value is valid.

    No activation of the exit routines takes place when system tasks or ARCHIVE subtasks are terminated.

  • Return exit on program termination

    All files of the user program are already closed (implicit CLOSE ALL via termination processing) at call time.

DSECT

         $TERMRF MF=D
         MFCHK MF=D,                                                   C
               SUPPORT=(C,D,L),                                        C
               PREFIX=E,                                               C
               MACID=NRT,                                              C
               DMACID=NRT,                                             C
               DNAME=NRTPL,                                            C
               PARAM=
ENRTPL   DSECT ,
               *,##### PREFIX=E, MACID=NRT #####
         #INTF REFTYPE=REQUEST,                                        C
               INTNAME=NRTPARA,                                        C
               INTCOMP=001
*
* THIS MACRO GENERATES THE DSECT FOR THE PARAMETER LIST WHICH IS
* EXCHANGED BETWEEN THE MODULS NRTCTRL, NRTTERM AND EXTERNAL MODULS.
*
* TO PREVENT ABUSE OF THE GIVEN EQUATES, THE TEST METHOD TO BE USED IS
* INDICATED BY THE ABBREVIATIONS:
*     (TM)  EACH BIT OF THE DATA FIELD HAS A MEANING OF ITS OWN,
*           NO MEANING IS DISPLAYED AS A COMBINATION OF BITS.
*           USE THE "TM"-STATEMENT WHEN TESTING IF A BIT IS SET.
*           THIS ALSO ALLOWS TESTING OF TWO OR MORE DIFFERENT
*           FEATURES AT THE SAME TIME.
*     (CL)  ONLY A CERTAIN COMBINATION OF SET BITS INDICATES A
*           FEATURE. USE THE "CLI"-STATEMENT WHEN TESTING A
*           COMBINATION.
*
         FHDR  MF=(C,ENRT),EQUATES=NO
         DS    0A
ENRTFHE  DS    0XL8            0   GENERAL PARAMETER AREA HEADER
*
ENRTIFID DS    0A              0   INTERFACE IDENTIFIER
ENRTFCTU DS    AL2             0   FUNCTION UNIT NUMBER
*                                  BIT 15    HEADER FLAG BIT,
*                                  MUST BE RESET UNTIL FURTHER NOTICE
*                                  BIT 14-12 UNUSED, MUST BE RESET
*                                  BIT 11-0  REAL FUNCTION UNIT NUMBER
ENRTFCT  DS    AL1             2   FUNCTION NUMBER
ENRTFCTV DS    AL1             3   FUNCTION INTERFACE VERSION NUMBER
*
ENRTRET  DS    0A              4   GENERAL RETURN CODE
ENRTSRET DS    0AL2            4   SUB RETURN CODE
ENRTSR2  DS    AL1             4   SUB RETURN CODE 2
ENRTSR1  DS    AL1             5   SUB RETURN CODE 1
ENRTMRET DS    0AL2            6   MAIN RETURN CODE
ENRTMR2  DS    AL1             6   MAIN RETURN CODE 2
ENRTMR1  DS    AL1             7   MAIN RETURN CODE 1
ENRTFHL  EQU   8               8   GENERAL OPERAND LIST HEADER LENGTH
*
         ORG   ENRTRET
*                                      ******************
ENRTRC   DS    F                       *  RETURN CODE   *
*                                      ******************
*                                      PLEASE USE THE RETURNCODE
*                                      IN THE STANDARDHEADER
*                                      (MAINCODE 1)!
*                                      ------------------------------
*                                      THIS IS THE ONLY PART OF
*                                      NRTPARA THAT MAY BE MANI-    120
*                                      PULATED BY THE CALLED
*                                      ROUTINES
         ORG   ENRTRC
ENRTSCD  DS    XL1                (CL) SECONDARY CODE
ENRTNACT EQU   X'0C'                   NO ACTION PERFORMED
*
         DS    XL2                     UNUSED
*
ENRTRCD  DS    XL1                (CL) RETURN CODE
ENRTSUCC EQU   X'00'                   FUNCT. SUCCESSFULLY PERFORMED
ENRTERR  EQU   X'04'                   FUNCT. FAULTY - TERM. TASK
*
ENRTRES1 DS    3F                      USED ONLY BY NRT - NOT FOR
*                                      EXTERNAL ROUTINES!
*
ENRTWORK DS    A                       GENERAL WORK AREA ADDRESS
*
ENRTOUT  DS    XL1                (CL) OUTPUT PARAMETER FIELD       120
*
ENRTDMPN EQU   0                       CDUMP SHOULD BE NOT CALLED   120
ENRTDMPY EQU   1                       CDUMP CAN BE CALLED          120
ENRTRETN EQU   2                       RETURN TO PROGRAM            120
ENRTCMDP EQU   3                       CALL COMMAND PROCESSING      120
ENRTCONT EQU   4                       CONTINUE TERMINATION         120
*
ENRTDUMP DS    XL1                (TM) DUMP REQUEST                 120
*
ENRTDIAG EQU   X'04'                   DIAGNOSIS DUMP REQUESTED     121
ENRTSDMP EQU   X'02'                   SYSTEM DUMP REQUESTED        121
ENRTUDMP EQU   X'01'                   USER DUMP REQUESTED          121
ENRTDPNN EQU   X'00'                   NO DUMP REQUESTED            121
*
         DS    XL2                     RESERVED                     120
*
ENRTINFO DS    A                       SPECIFIC INFORMATION FOR THE
*                                      CALLED ROUTINE. CURRENTLY ONLY
*                                      NAME MANAGER INFORMATION IS
*                                      PROVIDED WHEN REQUIRED.
         ORG   ENRTINFO
ENRTNMCL DS    XL3                     NAME MANAGER INFORMATION FIELD.
ENRTCLAS DS    AL1                (CL) INDICATES THE CURRENT NAME
*                                      MANAGER CLASS OR ZERO FOR
*                                      DYNAMIC CLASSES.
*
*
ENRTREQ  DS    XL1                (TM) TERMINATION REQUEST.
*
ENRTNPTR EQU   X'01'                   NONPRIVILEGED TERMINATION
*                                      REQUEST (TERM,TERMD,TERMJ,TRMJD)
ENRTTERM EQU   X'02'                   PRIVILEGED TERMINATION REQUEST
*                                      ($TERM) AND NONPRIVILEGED
*                                      REQUEST ISSUED IN P2
ENRTTRMT EQU   X'04'                   TERMINATION REQUEST DUE TO
*                                      SYSTEM ERROR                 120
*
*
ENRTFUNT DS    XL1                (CL) TERMINATION UNIT TO BE
*                                      EXECUTED.
ENRTPRGR EQU   X'01'                   TERMINATION UNIT IS
*                                      PROGRAM.
ENRTSTEP EQU   X'02'                   TERMINATION UNIT IS STEP.
ENRTTASK EQU   X'04'                   TERMINATION UNIT IS TASK.
ENRTJOB  EQU   ENRTTASK                 TERMINATION UNIT IS JOB.
*                                      AT PRESENT JOB IS EQUIVALENT
*                                      TO TASK
*
*
ENRTTTYP DS    XL1                (CL) TERMINATION TYP
*
ENRTNORT EQU   X'00'                   NORMAL TERMINATION
ENRTABNT EQU   X'04'                   ABNORMAL TERMINATION
*
*
ENRTCUNT DS    XL1                (CL) CURRENT TERMINATION UNIT.
*
*                                      USE THE EQUATES DEFINED UNDER
*                                      "TERMINATION UNIT TO BE
*                                      EXECUTED" FOR PROGRAM, JOB
*                                      STEP, TASK AND JOB TERMINATION!
*
         DS    0F
ENRTCMPC DS    CL4                     COMPLETION CODE FOR JOB VARIABLE
*                                      SUPPORT
*
ENRTCMD  DS    XL1                (TM) INFORMATION ON THE COMMAND THAT
*                                      INITIATED TERMINATION
ENRTLGOF EQU   X'01'                   LOGOFF COMMAND
ENRTABND EQU   X'02'                   ABEND COMMAND
ENRTCAN  EQU   X'04'                   CANCEL COMMAND
ENRTSHUT EQU   X'08'                   SHUTDOWN COMMAND
ENRTEXLD EQU   X'10'                   EXEC OR LOAD COMMAND
ENRTPOSX EQU   X'20'                   EVENT=POSIX                  121
*
*
ENRTLGFC DS    XL1                (TM) INFORMATION ON LOGOFF COMMAND.
*
ENRTLGBT EQU   X'01'                   LOGOFF BUT
ENRTLGTP EQU   X'02'                   LOGOFF TAPE
ENRTLGNS EQU   X'10'                   LOGOFF NOSPOOL
ENRTLGNO EQU   X'06'                   EXIT-JOB  - NO SYSOUT        201
ENRTLGNL EQU   X'0A'                   EXIT-JOB  - NO SYSLST        201
*
*
ENRTCANC DS    XL1                (TM) INFORMATION ON CANCEL COMMAND
*
ENRTOPER EQU   X'02'                   CANCEL BY OPERATOR-TASK
ENRTTSOS EQU   X'04'                   CANCEL BY $TSOS
ENRTUSID EQU   X'08'                   CANCEL BY SAME USER-ID
ENRTHOST EQU   X'10'                   CANCEL BY ANOTHER HOST
*
*
         DS    CL1                     RESERVED                     120
*
*
*
         DS    XL1
ENRTTRMC DS    CL7                     TERMINATION CODE - 7 BYTES
         ORG   ENRTTRMC+3
ENRTCODE DS    CL4                     TERMINATION CODE - 4 BYTES
*                                      NOT SUPPORTED AFTER V8.0!
*
*
ENRTPLE  DS    0F                      WORD ALIGNMENT IS SUFFICIENT 120
*
ENRT#    EQU   *-ENRTFHE