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 

String arguments to SETUAI?

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



Joined: 15 Jan 2005
Posts: 24
Location: Sooke, BC, Canada

PostPosted: Thu Dec 20, 2012 9:29 pm    Post subject: String arguments to SETUAI? Reply with quote

Hi; I am trying to use setuai for the first time. I can get it to work fine using numeric arguments, but I can't seem to successfully use a string argument:

Code:

>>> from vms.starlet import setuai
>>> from vms.uaidef import *
>>> from vms.itemList import *
>>> wsextent = itemList(code=UAI__WSEXTENT, value=32768, dtype=il_unsignedLong)
>>> username = 'TEST_ACCT'
>>> s, ctxt = setuai(usrnam=username, itmlst=[wsextent,])
>>> defdir = itemList(code=UAI__DEFDIR, value='[USERS.TEST_ACCT]', dtype=il_count1String)
>>> s, ctxt = setuai(usrnam=username, itmlst=[defdir,])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
VMSError: [Errno 20] %SYSTEM-F-BADPARAM, bad parameter value

Can anyone help me figure out what I am doing wrong?

Cheers,
_________________
Howard Taylor
Badger Consulting
Sooke, BC, Canada
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jfp



Joined: 12 Jul 2004
Posts: 633

PostPosted: Fri Dec 21, 2012 12:37 pm    Post subject: Reply with quote

Hi,
The following code should work:

Code:
from vms.starlet import setuai
from vms.uaidef import *
from vms.itemList import *
wsextent = itemList(code=UAI__WSEXTENT, value=32768, dtype=il_unsignedLong)
username = 'TEST_ACC'
s, ctxt = setuai(usrnam=username, itmlst=[wsextent,])
defdir = '[USERS.TEST_ACCT]'
defdir = chr(len(defdir)) + defdir + ' ' * (63 - len(defdir))
defdir = itemList(code=UAI__DEFDIR, value=defdir)
s, ctxt = setuai(usrnam=username, itmlst=[defdir,])


JF
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bonzothecat



Joined: 15 Jan 2005
Posts: 24
Location: Sooke, BC, Canada

PostPosted: Fri Dec 21, 2012 2:40 pm    Post subject: Reply with quote

Yay! Works great, thanks, JF. Now I can have a happy Christmas, I wish you one too!
_________________
Howard Taylor
Badger Consulting
Sooke, BC, Canada
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jescab



Joined: 28 Jan 2008
Posts: 254

PostPosted: Sat Dec 22, 2012 1:14 am    Post subject: Reply with quote

Now, how on earth would you have guessed that if you didn't had a working example... Smile
Back to top
View user's profile Send private message
jfp



Joined: 12 Jul 2004
Posts: 633

PostPosted: Sat Dec 22, 2012 11:25 am    Post subject: Reply with quote

From the system services documentation:

Quote:
...
UAI$_DEFDIR
Sets, as a 1- to 63-character string, the name of the default directory.
Because the directory name string can include up to 63 characters plus a size-byte prefix, the buffer length field in the item descriptor should specify 64 (bytes).
...


JF
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bonzothecat



Joined: 15 Jan 2005
Posts: 24
Location: Sooke, BC, Canada

PostPosted: Sat Dec 22, 2012 11:47 pm    Post subject: Reply with quote

I find that trying to figure out the arguments is half the fun of programming with OpenVMS system services. Smile
_________________
Howard Taylor
Badger Consulting
Sooke, BC, Canada
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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