I want to do this:
:SET &USERNAME# = GET_LOGIN(&$LOGIN#,&$AGENT#,&$PLATFORM#,LOGIN_INFO)
Unfortunately, it doesn’t work, because GET_LOGIN doesn’t allow reading login entries for the built-in platforms like UNIX and WINDOWS.
U00020679 Runtime error in object 'UC0.MYJOB1' line '00002': The provided type 'UNIX' is not allowed
Is there a platform-agnostic way around this? I don’t want to read the password, only the user name.
The error message seems to be complaining that 'UNIX' isn't one of the custom backend login types that you defined in UC_LOGIN_TYPES -- this :GET_LOGIN function only works for those. (I agree that it would be nice if this GET_LOGIN function would operate on all login types, not just custom ones, however.)
Could you do this?
:SET &USERNAME# = GET_ATT(USERID)
...or is the whole point here to be able to read this username from outside of the job itself?
The fact that it’s not possible to read passwords for built-in LOGIN types is an intentional security feature, as Wolfgang Brückler points out below. However, it would make sense if GET_LOGIN were able to read the user name from all LOGIN types.
You can only read the login entries of self-defined systems or applications, not from operating systems!! Make sure that the specified Type is also available in the UC_LOGIN_TYPES variable. For more information, seeUC_LOGIN_TYPES - Defining Additional Platform and System Types for Login Objects
That means you can not use any OS type (Win, unix, ...) but you must specify an own login-type like "mail" or whatever.
This is a security feature.....
I'm familiar with this security feature. I reported the bug that led to it.
Daryl Brown’s approach using GET_ATT works. If I ever need to read LOGIN object information from outside of a job, I will just read it from the OLC table.