forum.vmspython.org Forum Index forum.vmspython.org
Forum system
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Python Beginner on OpenVMS

 
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS
View previous topic :: View next topic  
Author Message
klaus



Joined: 16 Oct 2012
Posts: 3

PostPosted: Tue Oct 16, 2012 2:55 pm    Post subject: Python Beginner on OpenVMS Reply with quote

Hello,
for an possible migration project (openVMS--> linux , DCL --> Python) i have to examine the possibility to write our DCL-Scripts in Python. For this i need some basic help. Python is installed on OpenVMS and single commands are working [print ("hello")] Laughing
Is there an an basic tutorial available for translating DCL to Python ! If not I have a lot of questions ! For example:
--> nodename = f$getsyi ("nodename") ??
--> using global vms-symbols...in python (from an other dcl-Procedure)
--> error-handling and exit-code .... exit $status
thanks for help
klaus
Back to top
View user's profile Send private message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Wed Oct 17, 2012 12:37 am    Post subject: Reply with quote

Do you know Python as such before? Or is that new to you?

--> nodename = f$getsyi ("nodename") ??
Code:

$
$ write sys$output f$getsyi("nodename")
OSSBY1
$
$ python
Python 2.7.2+ (default, Oct  4 2011, 21:13:00) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> from vms.rtl.lib import getsyi
>>> import vms.syidef
>>> s, rv, host, csid = getsyi(vms.syidef.SYI__NODENAME)
>>> print host
OSSBY1
>>>

--> using global vms-symbols...in python (from an other dcl-Procedure)
Code:

$ abc == "def"
$ python
Python 2.7.2+ (default, Oct  4 2011, 21:13:00) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> from vms.rtl.lib import get_symbol
>>> s, resultant_string, table_type_indicator = get_symbol('abc')
>>> print resultant_string
def

--> error-handling and exit-code .... exit $status
Code:

$ python
Python 2.7.2+ (default, Oct  4 2011, 21:13:00) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exit(5)
$ sh sym $status
  $STATUS == "%X00000005"
$
Back to top
View user's profile Send private message
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Wed Oct 17, 2012 11:41 am    Post subject: Reply with quote

To see the list of vms.rtl.lib functions :
Code:

$ python
Python 2.7.2+ (default, Oct  4 2011, 21:13:00) [DECC] on OpenVMS
Type "help", "copyright", "credits" or "license" for more information.
>>> import vms.rtl.lib
>>> help (vms.rtl.lib)
Help on package vms.rtl.lib in vms.rtl:

NAME
    vms.rtl.lib

FILE
    /python_root/local/vms/rtl/lib/__init__.py

PACKAGE CONTENTS
    _vmslib

FUNCTIONS
    SWIG_PyInstanceMethod_New(...)
   
    convert_date_string(...)
        status, date_time, context, defaulted_fields = convert_date_string(date_
string [,context] [,flags] [,defaults])
   
    cvt_from_internal_time(...)
        status, resultant_time = cvt_from_internal_time(operation, [input_time])
   
    cvt_vectim(...)
        status, resultant_time = cvt_vectim(input_time)
   
-- more --
...
...

Press ENTER for 5-6 screens with different functions... Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vmspython.org Forum Index -> Python for OpenVMS All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group