Skip to content

Instantly share code, notes, and snippets.

@wags
Last active August 29, 2015 13:57
Show Gist options
  • Save wags/9686247 to your computer and use it in GitHub Desktop.
Save wags/9686247 to your computer and use it in GitHub Desktop.
Get UniVerse Server Name
***
*** Get the computer name (Windows) from the data returned by the ENV[IRONMENT] command.
*** Local function technique requires UniVerse version 11.2 or greater
***
DEFFUN getComputerName
RESULT = getComputerName()
CRT "COMPUTER NAME IS ":RESULT
END
FUNCTION getComputerName
EXECUTE "ENV" CAPTURING ENVIRONMENT.DATA
ENVIRONMENT.DATA.ARRAY = CHANGE(ENVIRONMENT.DATA, "=", @VM)
FINDSTR "COMPUTERNAME" IN ENVIRONMENT.DATA.ARRAY SETTING F, V THEN
COMPUTERNAME.VALUE = V+1
RESULT = ENVIRONMENT.DATA.ARRAY<F,COMPUTERNAME.VALUE>
END ELSE
RESULT = "ERROR"
END
RETURN (RESULT)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment