There are several ways to get the client’s user name when running in Thin Client. Here are 2 common methods.
A$CURRENT_USER
You can call A$CURRENT-USER to get a lot of information about the client, including the user-id. If you use the application server’s login by setting iscobol.as.authentication=2 it will return that user name. Otherwise it returns their operating system’s user name. Here’s the syntax of that library routine.
CALL A$CURRENT_USER USING ID
username
userAddr
userComp
threadID
prog
[type]
[loginTime]
[userInfo]
GIVING returnCode
Using the windows API function “GetUserName” with CALL CLIENT
This method will get the user name on the local machine if you run in fat client, and the client machine if you run in thin client. Here’s a code snippet as an example.
Please give the following code a try:
program-id. prg.
working-storage section.
77 userName pic x(32).
77 len pic 99 value 32.
procedure division.
main.
call client "C$SETENV" using "dll_convention", "1".
call client "GetUserNameA" using by reference username
by reference len
on exception
call client "ADVAPI32.dll"
call client "GetUserNameA" using by reference username
by reference len
end-call.
display userName.
goback.
Article ID: 244
Created: April 20, 2015
Last Updated: January 12, 2026
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=244