User bio
404 bio not found
Member since Jul 25, 2017
Replies:

Try this method

Class DC.Util Extends %RegisteredObject
{

/// Return: the OS username for this Cache/IRIS instance
/// 	
/// First, get the port of the superserver
/// then search, which job owns that port
/// then return the OSUsername for that job
/// 
ClassMethod OSUsername()
{
	new $namespace
	set $namespace="%SYS"
	
	if ##Class(Config.Startup).Get(.par),$d(par("DefaultPort"),port) {
		set job="", pattern=".e1""|TCP|"_port_"*"".e"
		for  set job=$zj(job) quit:$v(-1,job)?@pattern||(job="")
		
		if job {
			set proc=##class(%SYS.ProcessQuery).%OpenId(job)
			ret:proc proc.OSUserName
		}
	}
	ret ""
}

}

A note:
- I know of a $zu(...) function which works and returns the superserver port but $zu() functions are  deprecated/discouraged  
- and this one is not in the replacement list - why?

Certifications & Credly badges:
Julius has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Following:
Julius has not followed anybody yet.