A$LIST_USERS
The A$LIST_USERS library routine provides a number of functions to retrieve the list of users currently connected to the Application Server.
Note - The list will include only yourself if the current thin client session is running in a separate task due to the iscobol.as.multitasking setting.
Syntax:
 CALL "A$LIST_USERS" USING opCode 
                           parameters
                    GIVING returnCode
Parameters:
opCode
It is the function to be executed. Valid values, defined in iscobol.def, are:
 
Open the list.
Retrieve the next item in the list.
Close a previously open list.
parameters
Parameters depend on the opcode.
Return code:
The definition and meaning of the returnCode depend on the opcode.
Examples:
Example - Get the list of users connected to an Application Server. Call a$list-users to open the list, loop through all the next users and then close the list
working-storage section.
copy "iscobol.def".
77  usrlist                 handle.
77  usr-id                  pic x(3).
77  usr-name                pic x(32).
77  usr-addr                pic x(32).
77  usr-pcname              pic x(32).
77  usr-tid                 pic x(32).
77  usr-prog                pic x(32).
77  usr-type                pic 9.
77  usr-login               pic x(16).
77  usr-count               pic 9(5).
...
procedure division.
...
get-users-list.
    call "a$list-users" using listusr-open
                       giving usrlist
    if usrlist < 1
       display message "Error on User Count!"
       exit paragraph
    end-if
    move 0 to usr-count
    perform until 1 = 2
       call "a$list-users" using listusr-next
                                 usrlist
                                 usr-id
                                 usr-name 
                                 usr-addr 
                                 usr-pcname
                                 usr-tid
                                 usr-prog
                                 usr-type
                                 usr-login
       if return-code = 0
          exit perform
       end-if
       display "User ID: " usr-id "  User Name: " usr-name 
       add 1 to usr-count
    end-perform
    call "a$list-users" using listusr-close
                              usrlist
    display message "Number of users connected : " usr-count
    .