(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_sys, prev: FINISH_RDB, next: GETJPIW)


FORCEX - Force Exit


Causes an Exit ($EXIT) service call to be issued on behalf of a specified process.

Format:

    targpid = vms_sys.forcex ([pidadr] [,prcnam] [,code])
Returns:
targpid
Process identification of process that has been forced to exit - unless, of course the process has forced itself to exit ...
The targed PID (targpid) is always returned - it is as if you have specified a '0' value for the 'pidadr' argument. If an error happens, then vms_sys.forcex() raises a Python exception.
Arguments:
pidadr
Process identification of process to be forced to exit.
prcnam
Process name of process to be forced to exit.
code
Completion code value to be used as the exit parameter.
Examples:
>>> import vms_sys

>>> print vms_sys.forcex ()
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (0)
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (None)
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (0,'')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (340, '%SYSTEM-F-IVLOGNAM, invalid logical name')

>>> print vms_sys.forcex (None,'')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (340, '%SYSTEM-F-IVLOGNAM, invalid logical name')

>>> print vms_sys.forcex (None,None)
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (None,None,None)
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (None,None,0)
%NONAME-W-NOMSG, Message number 00000000
$ ! current process forced to exit

>>> print vms_sys.forcex (None,None,44)
%SYSTEM-F-ABORT, abort
$ ! current process forced to exit - 44 == SS$_ABORT

>>> pid = 360
>>> prcnam = 'TARG_PRC'
>>> print vms_sys.forcex (pid)
360                     <-- this is the target PID
:TARG_PRC output:
%NONAME-W-NOMSG, Message number 00000000

>>> vms_sys.forcex (pid,None,44)
360                     <-- this is the target PID
:TARG_PRC output:
%SYSTEM-F-ABORT, abort

>>> vms_sys.forcex (0,prcnam,44)
360                     <-- this is the target PID
        Note that the process name was used, not PID 0.
        0 means the target process should be returned.
:TARG_PRC output:
%SYSTEM-F-ABORT, abort

Note: 'None' for Argument 1 is internally changed to 0!
>>> vms_sys.forcex (None,prcnam,44)
360                     <-- this is the target PID
        Note that the process name was used, not PID 0
:TARG_PRC output:
%SYSTEM-F-ABORT, abort

>>> vms_sys.forcex (999)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> vms_sys.forcex (None,'NO_SUCH_PRC')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> vms_sys.forcex (None,'PROCESS_NAME_TO_LONG')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (340, '%SYSTEM-F-IVLOGNAM, invalid logical name')

>>> vms_sys.forcex ('BAD')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 1: pidadr - must be integer or None

>>> vms_sys.forcex (None,1)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: expected read-only buffer, int found

>>> vms_sys.forcex (None,None,'BAD')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: code - must be integer or None
>>>

(go to: table of contents, index, list of vms_sys, prev: FINISH_RDB, next: GETJPIW)

28-SEP-1998 ZE.