(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: ADD_TIMES, next: ATTACH)


ASN_WTH_MBX - Assign Channel with Mailbox


Format:
    device_channel, mailbox_channel= vms_lib.asn_wth_mbx \
        (device_name, [maximum_message_size] [,buffer_quota])
Returns:
device_channel
Channel to device, received from SYS$ASSIGN. A 16-bit Python integer.
mailbox_channel
Channel to mailbox, received from SYS$CREMBX. A 16-bit Python integer.

Both I/O channels can be closed by the vms_sys.dassgn() system service.

Arguments:

device_name
name of device that will be passed to SYS$ASSIGN
maximum_message_size
maximum message size that can be sent to the mailbox
buffer_quota
number of system dynamic memory bytes that can be used to buffer messages sent to the mailbox
Examples:
>>> import vms_lib

>>> devchn, mbxchn = vms_lib.asn_wth_mbx ("TT")
>>> print devchn, mbxchn
240 224

>>> print vms_lib.getdvi ("DVI$_DEVNAM", devchn)
_FTA13:
>>> print vms_lib.getdvi ("DVI$_DEVNAM", mbxchn)
_MBA233:

(Note: the device name argument is omitted in vms_lib.getdvi())

$ show device/full _MBA233:
Device MBA233: is online, record-oriented device, shareable,
 mailbox device.

  Error count                0    Operations completed              0
  Owner process             ""    Owner UIC             [HOME,ZESSIN]
  Owner process ID    00000000    Dev Prot          S:RWPL,O:RWPL,G,W
  Reference count            2    Default buffer size             256


>>> devchn, mbxchn = vms_lib.asn_wth_mbx("TT",44,33)
>>> print devchn, mbxchn
240 224
>>> print vms_lib.getdvi ("DVI$_DEVNAM", mbxchn)
_MBA241:
>>>

$ show device/full _MBA241: ! from a different process
Device MBA241: is online, record-oriented device, shareable,
 mailbox device.

  Error count                0    Operations completed              0
  Owner process             ""    Owner UIC             [HOME,ZESSIN]
  Owner process ID    00000000    Dev Prot          S:RWPL,O:RWPL,G,W
  Reference count            2    Default buffer size              44
$!                                                          -----> **

>>> # close these channels
>>> import vms_sys
>>> vms_sys.dassgn (devchn)
>>> vms_sys.dassgn (mbxchn)

$ show device/full _MBA241: ! from a different process
%SYSTEM-W-NOSUCHDEV, no such device available
$ ! -> channel closed, mailbox deleted

>>> # 1st call
>>> devchn, mbxchn = vms_lib.asn_wth_mbx("TT")
>>> # 2nd call
>>> devchn, mbxchn = vms_lib.asn_wth_mbx("TT")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (708, '%SYSTEM-F-DEVACTIVE, device is active')
>>>

>>> devchn, mbxchn = vms_lib.asn_wth_mbx("NO_SUCH_DEV")
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (324, '%SYSTEM-F-IVDEVNAM, invalid device name')
>>>

(go to: table of contents, index, list of vms_lib, prev: ADD_TIMES, next: ATTACH)

29-NOV-1998 ZE.