Highlighted
Absent Member.
Absent Member.
611 views

[archive] Local Machine Name

[Migrated content. Thread originally posted on 22 July 2009]

I know this question that may have been asked before but I could not find it. I need to know how to get the local machine name when running on with a windows runtime.

I use the terminal-info to get the client-machine-name when running thin client, but this field is blank on a windows runtime since there are no terminal abilities. I have a file that keeps track of the machines which accessed a file and at what time. I have everything I need when running thin client but not on windows. Any help would be greatly appreciated.
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Local Machine Name

I think something like the following should work for you:


01 WS-COMPNAME      PIC X(60).
01 WS-SIZE               PIC X(4) COMP-N. 

SET ENVIRONMENT "DLL_CONVENTION" TO 1.
CALL "kernel32.dll".
MOVE SPACES TO WS-COMPNAME.
SET WS-SIZE TO SIZE OF WS-COMPNAME.
CALL "GetComputerNameA" USING
         BY REFERENCE WS-COMPNAME
         BY REFERENCE WS-SIZE
END-CALL.
INSPECT WS-COMPNAME REPLACING ALL LOW-VALUES BY SPACES.
CANCEL "kernel32.dll".
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Local Machine Name

We have 2 Versions how Users can work.
Inhouse or Remote (RDP-Connection)...

Windows set Environment-Variables for Clientname and Computername which you can accept.

77 env-clientname pic x(15) value spaces.
77 env-compname pic x(15) value spaces.


accept env-clientname from environment "CLIENTNAME".
accept env-compname from environment "COMPUTERNAME".

if env-compname(1:3) = "SRV"
move env-clientname to env-compname.


All Terminal-Servers begin with "SRV" (our intern naming convention) so i know that i must use the Clientname as Computername.

If the users work Inhouse the Clientname is always blank (spaces).
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Local Machine Name

Thanks for your suggestions, both worked great. We decided to use the accept from the environment.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.