Using the whoami command
The whoami command displays a username associated with the effective user ID, unlike the who am i command, which displays the login name.
For example, if you login as user1 and then use the su command
to change to 'user2':
command returned
who am I user1
whoami user2
For more information about the whoami command, see the whoami command
description in z/OS UNIX System Services Command Reference.