[Info-vax] VMS Python: Calling sys$trnlnm()
Andrew Shaw
andrew at feeandl.com
Fri Mar 27 03:46:15 EDT 2020
Hi folks,
I have a technical Python question I need help with.
I've posted to the forum on vmspython.org, (now that its back up - Thanks JPF) but the last activity there was 6 months ago so I'm unsure how active it is, so thought I would try here as well - apologies if this isn't the right forum, but I know there are seriously clever folks here !
Here's my post from over there, with my issue:
I'm making a call to trnlnm() in my Python code and need some help decomposing the Itemlist I'm getting back.
My call looks like this:
attr=0
s, d = trnlnm (attr,
"LNM$FILE_DEV",
"MYLOGICAL",
None,
(
itemList(LNM__STRING),
itemList(LNM__ATTRIBUTES)
)
)
The call seems to work in that d[LNM__STRING] gives me my logical equivalence name back as a string - perfect.
I also want to know the TRANS=TERMINAL attribute of the logical.
Hence me also providing LNM__ATTRIBUTES as the second item in the itemlist.
What I get back in d[LNM__ATTRIBUTES] is what looks like a 4 byte "string" of unprintable ASCII. when I print the d dictionary I see this:
d = {2: 'MY_EQUIV_STR', 3: '\x01\x07\x01\x00'}
I understand that (in the C world anyway) this second item is a bitmask which you can & with the constant LNM$M_TERMINAL and you get True or False according to whether the TERMINAL bit is set. This works 100% in my sample C code where I do exactly that.
This is what I am struggling to replicate in Python.
Any attempt to do masking on this field gives me a type mismatch error between str and long. the dict entry seems to be a string of 4 bytes, but unprintable and I haven't found a way to turn this into something I can do a mask on - or even interpret another way.
The above hex string is what I get when I pass it a TRANS=TERM logical
When I pass it a logical which is NOT TERM, I get a slightly different "string" back: \x00\x04\x01\x00
So it is different by a couple of bits and I'm hoping that's the difference I am looking for. The other different bit *may* be the CONCEALED attribute, I haven't investigated enough yet.
Any tips?
More information about the Info-vax
mailing list