[Info-vax] VMS Python: Calling sys$trnlnm()

Andrew Shaw andrew at feeandl.com
Fri Mar 27 22:54:16 EDT 2020


Thanks folks for all your feedback, problem is now solved :-)

I went with unpack in the end - I agree that its a useful tool to have in your belt and so I wanted to understand it.

End result is below, for those worried about "readability and maintainability" :-)

Not quite finished testing yet, so will no doubt get minor bug fixes, but the shell is there.


# Translation worked
bResult = True
strResult = d[LNM__STRING]

# itemList(LNM_ATTRIBUTES) is returned as a hex "string" that needs to be interpreted as a bitmask
# The unpack routine takes care of this, by turning it into an unsigned int we can then mask
#
attrib = d[LNM__ATTRIBUTES]

# On our current Itanium Blades we are little-endian (<)
# '<' = Little endian
# 'I' = unsigned int
attrib = unpack('<I', attrib)[0]
		
# Check to see if the LNM_M_TERMINAL bit is set
if ( (attrib & LNM_M_TERMINAL) == LNM_M_TERMINAL ):
	bTerminal = True
	# Stop translating
else:
	bTerminal = False
	# Go around again
			
#=========================================
# Testing
# ----------------------------------------
# TRANS=TERMINAL Logicals
# -----------------------
# - LOG-1 = 512
# - LOG-2 = 512, Terminal
# - LOG-3 = 512, Terminal
#
# TRANS=(not) TERMINAL Logicals
# -----------------------------
# - LOG-4 = 0
# - LOG-5 - crashed when not found.
#           now trapped in try/except
# - LOG-6 - 0, NOT Terminal
#
#=========================================



More information about the Info-vax mailing list