Your Browser is not longer supported

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

{{viewport.spaceProperty.prod}}

TERM Terminate program and procedure step

&pagelevel(4)&pagelevel

General

Domain:


Job variables

Macro type:


Type S (standard form/E form/L form)

Macro description

The TERM macro performs the following functions:

  • terminate program (default value)

  • terminate program and procedure step (operand UNIT=STEP)

  • take memory dump (DUMP operand)

  • transfer return code to program-monitoring job variable (URETCD operand).

All input/output operations initiated by the program before execution of the macro are completed prior to program termination.

Macro call format and operand description

Operation

Operands

TERM

UNIT=PRGR / STEP

,DUMP=N / Y

,MODE=N[ORMAL] / A[BNORMAL]

[,URETCD=adr / (r) / code]

,MF=S / (E,..) / L


UNIT=
Determines whether a distinction according to operating modes is to be made when the program terminates.

PRGR
Default value; the program is terminated.

STEP

Terminates the program, with further action being determined by the operating mode in which the program executed.

    • Interactive mode:
      If the program was called in a non-S procedure, the system additionally branches to the next SET-JOB-STEP, EXIT-JOB or CANCEL-PROCEDURE command.
      If the program was called in an S procedure, the system additionally initiates SDF-P error recovery.

    • Batch mode (ENTER procedure):
      The system additionally branches to the next SET-JOB-STEP, EXIT-JOB, ABEND or LOGOFF command.

Note

The following settings are recommended:
UNIT=PRGR with MODE=NORMAL
UNIT=STEP with MODE=ABNORMAL

DUMP=
Determines whether a memory dump is to be taken.

N
Default value; no memory dump is taken.

Y
A memory dump is taken provided no MODIFY-TEST-OPTIONS command has been specified with DUMP=NO.

MODE=
Determines the termination mode of the program.

N[ORMAL]
Default value; the program is to terminate normally.
If a program-monitoring job variable is defined, its status indicator is set to C'$T'.

A[BNORMAL]
The program is to terminate abnormally. The message “.... ABNORMAL PROGRAM TERMINATION (&00)” is output.

(&00)= NRT0001 if UNIT=PRGR was specified
(&00)= NRT0101 if UNIT=STEP was specified

For users of job variables:
If a program-monitoring job variable has been defined, its status indicator is set to $A.

Note

see the UNIT operand.

URETCD=
This value is passed as the return code to the program-monitoring job variable (left-justified, bytes 4-7). If this operand is omitted, the value C''BLANK''BLANK''BLANK''BLANK'' is passed to the program-monitoring job variable.
The operand is ignored if no program-monitoring job variable has been defined.

code
Specifies an alphanumeric value, 1 to 4 bytes long, in decimal (C'cccc') or hexadecimal (X'xxxxxxxx') form.

addr
Relative virtual address of a 4-character alphanumeric value.

(reg)
Register containing a 4-character alphanumeric value. If URETCD=(reg) is specified, register R0 is destroyed.

MF=
For a general description of the MF operand, its associated operand values and any succeeding operands, see the section “The MF operand”.
The permitted MF values are indicated at the beginning of the macro description under the macro type, and in the macro call format.

Function

When this macro is executed the following occurs:

  • All files assigned to the program are closed.

  • The memory assigned to the program is released.

  • The BBS operations list and the entries in the BBS program table are released.

  • If an STXIT routine has been defined for the TERM event class, it is activated.

  • AIDSYS is called with the event “TERM”.

  • In the device table, bytes 8-30 are deleted for each device released. The first byte in the operation list is set to X'FF'. In the program table entry, the program start address is set to 0 (4 bytes).

  • The system then switches to command mode.

Notes

  • The operand is ignored if an invalid address is specified in the URETCD operand.

  • Register R1 contains the address of the data area.
    If the data area address is invalid or if incorrect operands were specified, TERM UNIT=STEP,MODE=ABNORMAL,DUMP=Y is executed and the following error message is issued:

    %.... ABNORMAL PROGRAM TERMINATION NRT0601

  • Calling the TERM macro with the operand DUMP=Y produces the message

    'PROCESSING INTERRUPTED AT...)'

    Whether or not a dump is taken depends on the value of the DUMP operand in the MODIFY-TEST-OPTIONS command. When DUMP=STD (default value) is set, TERM causes one of the following messages to be issued:

    • In interactive mode:
      'DUMP DESIRED ? REPLY (Y=YES, N=NO)'
      Whether or not a dump is output depends on the user's response.

    • In batch mode and in procedures:
      'SYSTEM REGULATIONS PROHIBIT DUMP'
      No dump is generated.