Last active
August 29, 2015 13:57
-
-
Save wags/9686247 to your computer and use it in GitHub Desktop.
Get UniVerse Server Name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** | |
*** 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