# Class Method: $system::getuserinfo()

Updated: 1/18/2022, 5:31:44 PM
Created: 1/18/2022, 5:31:44 PM
Last Updated By: dependabot[bot]
Read Time: 2 minute(s)

# Description

The getuserinfo() method is used to obtain user information based on port number. It creates a sub-object with a property name of user. The user sub-object contains sub-objects of a specific port number or ALL active port numbers.

If no arguments are given then all port numbers will be created as sub-objects.

If a specific port number is specified then only that port number's information will be created as a single sub-object.

If an invalid port number is specified then the sub-object will be void of any properties.

# Return value

The total number of active ports.

# Examples

program userinfo
portno = sentence(1)
sys = new object("$system")
user_count = sys->getuserinfo(portno)
userinfo = sys->user
print "User count = ":user_count
crt userinfo->$tojson(5)
crt
1
2
3
4
5
6
7
8

The following shows the results of running this program when the only active ports are 6 and 24:

jsh ~ -->userinfo 6
User count = 1
{
    "6":{
        "port_number":6,
        "number_programs":2,
        "connect_time":152,
        "listen_time":2,
        "pid":10740,
        "account_name":"Jedi",
        "user_name":"Yoda",
        "os_name":"Yoda",
        "terminal_jbase":"ntcon",
        "terminal_os":"ntcon",
        "database":"default",
        "tty":"CONIN$",
        "language":"en_US",
        "memory_free":556112,
        "memory_used":181872,
        "thread_type":"Normal",
        "open_app":7,
        "open_os":5,
        "host_name":"Dagobah",
        "stats":{
            "open":11,
            "read":22,
            "write":6,
            "delete":2,
            "clearfile":0,
            "execute":5,
            "input":39,
            "transend":0,
            "transabort":0,
            "lock":0,
            "lock_blocked":0,
            "release":4,
            "release_file":0
        }
    }
}

jsh ~ -->userinfo 1
User count = 0
{

}

jsh ~ -->userinfo
User count = 2
{
    "6":{
        "port_number":6,
        "number_programs":2,
        "connect_time":166,
        "listen_time":1,
        "pid":10740,
        "account_name":"Jedi",
        "user_name":"Yoda",
        "os_name":"Yoda",
        "terminal_jbase":"ntcon",
        "terminal_os":"ntcon",
        "database":"default",
        "tty":"CONIN$",
        "language":"en_US",
        "memory_free":554864,
        "memory_used":182102,
        "thread_type":"Normal",
        "open_app":8,
        "open_os":6,
        "host_name":"Dagobah",
        "stats":{
            "open":13,
            "read":28,
            "write":8,
            "delete":2,
            "clearfile":0,
            "execute":7,
            "input":53,
            "transend":0,
            "transabort":0,
            "lock":0,
            "lock_blocked":0,
            "release":6,
            "release_file":0
        }
    },
    "24":{
        "port_number":24,
        "number_programs":1,
        "connect_time":158,
        "listen_time":3,
        "pid":12104,
        "account_name":"Jedi",
        "user_name":"Yoda",
        "os_name":"Yoda",
        "terminal_jbase":"ntcon",
        "terminal_os":"ntcon",
        "database":"default",
        "tty":"CONIN$",
        "language":"en_US",
        "memory_free":523728,
        "memory_used":181371,
        "thread_type":"Normal",
        "open_app":7,
        "open_os":5,
        "host_name":"Dagobah",
        "stats":{
            "open":7,
            "read":8,
            "write":1,
            "delete":2,
            "clearfile":0,
            "execute":1,
            "input":5,
            "transend":0,
            "transabort":0,
            "lock":0,
            "lock_blocked":0,
            "release":1,
            "release_file":0
        }
    }
}

jsh ~ -->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

# Notes

Back to $system class