(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index)

This section gives some guidelines how to use the programming interface to OpenVMS routines.

functions

arguments

Some functions (e. g.: vms_lib.currency) do not have any arguments. If you provide any, then the programming interface WILL raise a Python exception. The redundant argument is not silently ignored!

Some arguments of a function might not apply in a specific situation. As keyword arguments are not implemented you have to insert 'None' instead. See the examples of vms_lib.day() or vms_lib.getdvi() to get an idea.

keyword arguments

e.g.: >>> ret = routine (p1 = val1)
are not supported.

functions returning no data

Some routines do not need to return any 'data' - e.g. vms_lib.attach() returns 'None' upon successful completion. If an error happens, they will still raise a Python exception.

OpenVMS condition values

Using the native interfaces a programmer should _always_ check the returned condition value. Some routines also use the OpenVMS condition mechanism to signal errors, but a programmer should not rely on it.

Almost all routines within Python do not return the 'status' code from the underlying OpenVMS service. They use the Python model of raising a Python exception when an error happens.

There are some routines which behave differently - e.g. vms_lib.set_logical(). The reason for this is a uniform style of returning data - in this case it is a dictionary.

special OpenVMS datatypes

Python on OpenVMS does not have a builtin 64-bit or 128-bit datatype.

64-bit quadword

These are simulated by using Python's "long int" datatype. See vms_sys.gettim() or vms_sys.asctim() for examples.

Using a "long int" does allow the programmer to do calculations within Python:
@@ add example of date and time calculations

128-bit octaword

These are simulated by using 32-character 'hex-strings'.
See vms_sys.getutc(), or vms_sys.ascutc() for examples.

processes

privileges

A Python on OpenVMS executable is not meant to be installed (via $INSTALL) with any privileges! Currently (08-MAR-1998) there is no way to turn off these elevated privileges and a user can always just '$RUN' the Python executable...

process identification (PID)

OpenVMS DCL utilities use an 8-character hex number as input and output for the PID and translate it internally because system services and run-time library routines use a binary longword.

Within Python on OpenVMS a PID must always be specified as an integer data type - it is never a hex-string. e.g.:

$ PID = F$GETJPI(0,"PID")
$ show symbol PID
PID = "0000021A"
$ NUMBER = %X'PID'
$ show symbol NUMBER
NUMBER = 538 Hex = 0000021A Octal = 00000001032
$

You have to use the number '538' within Python.

>>> ctx,data = vms_lib.getjpi("JPI$_IMAGNAME",538)
>>> print data
DKA100:[PYTHON.PYTHON-1_5_1.VMS]PYTHON_ALPHA.EXE;1
>>>

('ctx' is either the process' PID or, during wildcard lookups, a context value. Please see the description of vms_lib.getjpi() for details.)

Several system services (SYS$DELPRC, SYS$FORCEX, ...) return the target process' PID if you specifiy 0 for the PID argument and a process name.

For consistency the Python interface always returns the target process' PID - no matter if you specify an explicit PID or use the process name argument.

---
Almost all examples in this documentation use a 'low' value for the PID. This is because development happens on non-clustered OpenVMS systems.
(go to: table of contents, index)

12-AUG-1998 ZE.