Python on OpenVMS
(go to: table of contents,
index)
The 'vms_lbr' module provides access to some OpenVMS LBR$ routines.
(well, at the time of writing this (10-FEB-1998) it provides
only access to the OUTPUT_HELP routine...).
Most routines DO NOT return a status code;
they raise the exception 'vms_lbr.error' when something went wrong.
Routines that behave differently have it mentioned within their description.
Alphabetical list of routines:
OUTPUT_HELP - Output Help Messages
@@ WARNING! This routine is not fully debugged !!
Format:
status = vms_lbr.output_help (output_routine [,output_width]
[,line_desc] [,library_name] [,flags]
[,input_routine] )
Returns:
- status
- @@
Arguments:
- output_routine
- If you specify 'None', then the RTL routine LIB$PUT_OUTPUT will be
used internally.
- output_width
- Width of the help-text line that is passed to the user-supplied output
routine. Default is 80 characters per line.
- line_desc
- The help request line without the 'HELP' and any qualifiers. Default is
the empty string.
- library_name
- Name of the help library. Default is an empty string which indicates the
default help library (HELPLIB). If omitted, then device and directory
(SYS$HELP) and file type (.HLB) are supplied.
- flags
- Currently (01-MAR-1998), symbolic values for the flags (HLP_M_name) are
not available in VMSDEF. You must find out and supply the numerical values
yourself, sorry. See the OpenVMS documentation for details.
- input_routine
- If you specify 'None' or ommit this argument, then the RTL routine
LIB$GET_INPUT will be used internally.
Examples:
>>> import vms_lbr
>>> # define the output_routine
>>> def fnc_out(message_string):
... print "FNC_OUT(",message_string,") called"
... return 1
...
>>>
>>> # define the input_routine
>>> def fnc_inp(prompt_string):
... print "FNC_INP(",prompt_string,") called"
... r = (1,"SET")
... return r
...
>>>
>>> # use all defaults
>>> vms_lbr.output_help (None)
Information available:
:= = @ ACCOUNTING ALLOCATE ANALYZE APPEND
...
WRITE
Topic? <RETURN>
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # supply a specific output_width
>>> vms_lbr.output_help (None,40)
Information available:
:= = @
ACCOUNTING ALLOCATE ANALYZE
...
WAIT WRITE
Topic? <RETURN>
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # ?? @@ need to check this
>>> vms_lbr.output_help (None,None,"DIRECTORY")
Information available:
:= = @ ACCOUNTING ALLOCATE ANALYZE APPEND
...
WRITE
Topic? <RETURN>
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # specify help item and help library
>>> vms_lbr.output_help (None,None,"DIRECTORY","HELPLIB")
DIRECTORY
Provides a list of files or information about a file or group of
...
/WIDTH /WRAP
Examples
DIRECTORY Subtopic? <RETURN>
Topic? <RETURN>
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # specify an additional key
>>> vms_lbr.output_help (None,None,"DIRECTORY/OUTPUT","HELPLIB")
DIRECTORY
/OUTPUT
/OUTPUT[=filespec]
/NOOUTPUT
Controls where the output of the command is sent. By default,
...
the output file name will appear in the directory listing.
Topic?
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # specify an invalid key
>>> vms_lbr.output_help (None,None,"DIR_ECTORY","HELPLIB")
Sorry, no documentation on DIR_ECTORY
Additional information available:
:= = @ ACCOUNTING ALLOCATE ANALYZE APPEND
...
TYPE UCX UCX$TRACE UNLOCK VIEW WAIT WRITE
Topic?
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # specify a different help library
>>> vms_lbr.output_help (None,None,"SET","NCPHELP")
SET
Use the SET command to create or modify parameters or components
...
Additional information available:
CIRCUIT EXECUTOR PROXIES LINE LOGGING MODULE NODE
OBJECT
SET Subtopic?
Topic?
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # use a non-existing help library
>>> vms_lbr.output_help (None,None,"SET","NCP_HELP")
%HELP-E-OPENIN, error opening SYS$COMMON:[SYSHLP]NCP_HELP.HLB; as input
-RMS-E-FNF, file not found
%TRACE-E-TRACEBACK, symbolic stack dump follows
...
PYTHON main 10 00000030 00018430
276172954 <-- return status from OUTPUT_HELP
>>>
>>> status = 276172954 # manually assign to variable
>>> # build command string
>>> command = 'WRITE SYS$OUTPUT F$MESSAGE(' + str(status) + ')'
>>> command
'WRITE SYS$OUTPUT F$MESSAGE(276172954)'
>>> import os
>>> os.system (command)
%HELP-E-OPENIN, error opening !AS as input <-- [1]
65537 <-- [2]
>>>
[1] this is the output of 'command'
[2] this is the return status from os.system()
65537 = %RMS-S-NORMAL, normal successful completion
>>> # use an output routine (in Python!)
>>> print vms_lbr.output_help(fnc_out,40,"","HELPLIB")
FNC_OUT( ) called
FNC_OUT( Information available: ) called
FNC_OUT( ) called
FNC_OUT( := = @ ) called
FNC_OUT( ACCOUNTING ALLOCATE ANALYZE ) called
...
FNC_OUT( WAIT WRITE ) called
FNC_OUT( ) called
Topic?
1 <-- this is the status, returned from vms_lbr.output_help()
>>>
>>> # use an output and an input routine (both in Python!)
>>> print vms_lbr.output_help(fnc_out,40,"","HELPLIB",None,fnc_inp)
FNC_OUT( ) called
FNC_OUT( Information available: ) called
FNC_OUT( ) called
FNC_OUT( := = @ ) called
FNC_OUT( ACCOUNTING ALLOCATE ANALYZE ) called
...
FNC_OUT( WAIT WRITE ) called
FNC_OUT( ) called
vms_lbr__input_routine:ar_prompt_string->dsc$a_ptr=2146335280
vms_lbr__input_routine:ar_resultant_string->dsc$w_length=512
vms_lbr__input_routine:ar_resultant_string->dsc$a_ptr=2146336892
FNC_INP(
Topic? ) called
inp:str=SET=
vms_lbr__input_routine:ar_resultant_string=SET
vms_lbr__input_routine:l_status=-1
FNC_OUT( ) called
FNC_OUT( SET ) called
FNC_OUT( Sorry, no documentation on SET ?AII ) called
FNC_OUT( )IOI ) ,II ) ) called<CONTROL-Y>
*INTERRUPT*
$ STOP
@@ Obviously there is a bug, here ...
(go to: table of contents,
index)
08-MAR-1998 ZE.