(go to: table of contents, index, list of pyvms, prev: CRTL_FROM_VMS, next: CRTL_TO_VMS)
Note: the creat() and open() routine in the C RTL accept an optional argument
list. The Python interface requires that you specify all the arguments as a
single tuple that is passed as argument 4 - see the examples section below.
Format:
Do not use the "acc" or "err" keywords! The
interface does neither support these callback routines nor prevent use of them!
Examples:
CRTL_OPEN - call C RTL open() routine
Calls the C RTL open() routine. This is similar to the posix.open()
routine, but it allows to specify a fourth argument.
11-NOV-1999 ZE.
fd = pyvms.crtl_open (filename, flag [,mode] [,RMS-arguments])
Returns:
Arguments:
Use the routines in the 'posix' module to work with it.
>>> import os, pyvms
>>> # O_TRUNC requests a NEW version of the file to be created !
>>> flags = os.O_CREAT + os.O_TRUNC + os.O_WRONLY
>>> fd = pyvms.crtl_open \
... ('CRTL_OPEN.TMP' # filename
... ,flags # flags
... ,None # mode
... ,("alq=200","rat=ftn","rfm=stm") # RMS-arguments
... )
>>> import posix
>>> posix.write (fd, ' Hello!')
7 # number of bytes written
>>> posix.close (fd)
>>>
$ directory/full CRTL_OPEN.TMP
Directory DKA100:[PYTHON.PYTHON-1_5_1.VMS]
CRTL_OPEN.TMP;1 File ID: (12140,33,0)
Size: 1/200 Owner: [G1,SYSTEM]
Created: 31-DEC-1998 18:30:45.28
Revised: 31-DEC-1998 18:31:30.14 (1)
Expires: <None specified>
Backup: <No backup recorded>
Effective: <None specified>
Recording: <None specified>
File organization: Sequential
Shelved state: Online
File attributes: Allocation: 200, Extend: 0, Global buffer count: 0
No version limit
Record format: Stream, maximum 8 bytes
Record attributes: Fortran carriage control
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWED, Group:RE, World:
Access Cntrl List: None
Total of 1 file, 1/200 blocks.
$
----------
>>> flags = 0
>>> fd = pyvms.crtl_open \
... ('%CRTL_OPEN.TMP' # *BAD* filename
... ,flags # flags
... ,None # mode
... ,("alq=200","rat=ftn","rfm=stm") # RMS-arguments
... )
Traceback (innermost last):
File "<stdin>", line 1, in ?
pyvms.error: (100164, '%RMS-F-WLD, invalid wildcard operation')
>>>
----------
$!+
$! Create a simple test queue to demonstrate spool-on-close.
$! Need to point SYS$PRINT to this queue.
$!-
$ initialize /queue /device /noSTART PY_SPL_TEST
$ define SYS$PRINT PY_SPL_TEST
$ python
[...]
>>> import os, pyvms
>>> # O_TRUNC requests a NEW version of the file to be created !
>>> flags = os.O_CREAT + os.O_TRUNC + os.O_WRONLY
>>> fd = pyvms.crtl_open \
... ('SPOOL.TMP' # filename
... ,flags # flags
... ,None # mode
... ,("fop=spl",) # RMS-arguments
... ) # ^- need a tuple, here !
>>> import posix
>>> posix.write (fd, ' Hello!')
7 # number of bytes written
>>> posix.close (fd)
>>>
$ show queue /full /all PY_SPL_TEST
Printer queue PY_SPL_TEST, stopped, mounted form DEFAULT
/BASE_PRIORITY=4 /DEFAULT=(FEED,FORM=DEFAULT) /OWNER=[G1,SYSTEM]
/PROTECTION=(S:M,O:D,G:R,W:S)
Entry Jobname Username Blocks Status
----- ------- -------- ------ ------
23 SPOOL ZESSIN 1 Pending (queue stopped)
Submitted 12-MAR-1999 14:09 /FORM=DEFAULT /PRIORITY=100
File: _$99$DKA100:[PYTHON.PYTHON-1_5_1.VMS]SPOOL.TMP;1
$
$! -- cleanup
$ deassign SYS$PRINT
$ delete /queue PY_SPL_TEST
$ delete SPOOL.TMP;1
$
(go to: table of contents,
index,
list of pyvms,
prev: CRTL_FROM_VMS,
next: CRTL_TO_VMS)