$UsStatL: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(32 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$UsStatL}}
{{DISPLAYTITLE:$UsStatL}}
<span class="pageSubtitle"><section begin="desc" />Retrieve statistics for set of users into $list<section end="desc" /></span>
<span class="pageSubtitle">Retrieve statistics for set of users into $list</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $UsStatL function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $UsStatL function is the [[UserStatistics class]].</p>


This function allows retrieval of statistics for a set of users into a $list.  
==Syntax==
<p class="syntax"><span class="term">%result</span> = <span class="literal">$UsStatL</span>(<span class="term">list_identifier</span>, <span class="term">stat_list</span>, [<span class="term">criterion</span>])
</p>
 
===Syntax terms===
<table>
<tr><th>%result</th>
<td>Either a positive number, which is the milliseconds since the Online was brought up, or a negative [[#Error codes|error code]].</td></tr>


The $UsStatL function accepts three arguments and returns a numeric error code.  
<tr><th>list_identifier</th>
<td>The identifier of the $list to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:


The first argument is the identifier of the $list to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:
<table>
<table class="syntaxTable">
<tr><td>Byte 1-10</td>
<tr><th>Byte 1-10</th>
<td>Blank padded userid</td></tr>
<td>Blank padded userid</td></tr>
<tr><th>Byte 11-12</th>
 
<tr><td>Byte 11-12</td>
<td>Binary user number</td></tr>
<td>Binary user number</td></tr>
<tr><th>Byte 13-</th>
<td>Returned statistics
</td></tr></table>


<tr><td>Byte 13-</td>
<td>Returned statistics</td></tr>
</table>
</td></tr>
<tr><th>stat_list</th>
<td>A string of blank delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of 4 bytes. This facilitates the use of <var>$StatLD</var> with the returned $list. For more information about available statistics, see [[User statistics displayed in SirMon]]. </td></tr>


The second argument is a string of blank delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of 4 bytes. This facilitates the use of $StatLD with the returned $list. For more information about available statistics, see the ''"SirMon User's Guide"''.
<tr><th>criterion</th>
<td>A selection criterion that indicates which users are to be included in the output $list. The following criteria are allowed:


The third argument is a selection criterion that indicates which users are to be included in the output $list. The following criteria are allowed:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>ACCOUNT=acctid</th>
<tr><th><var>ACCOUNT=</var>acctid</th>
<td>include only users with account ids matching '''acctid''' (wildcards allowed).</td></tr>
<td>Include only users with account IDs matching <var class="term">acctid</var> (wildcards allowed).</td></tr>
<tr><th>CFR=fid</th>
 
<td>include only users holding or requesting critical file resources in files with filename matching '''fid''' (wildcards allowed).</td></tr>
<tr><th><var>CFR=</var>fid</th>
<tr><th>CHKP</th>
<td>Include only users holding or requesting critical file resources in files with <var class="term">filename</var> matching <var class="term">fid</var> (wildcards allowed).</td></tr>
<td>include only users preventing checkpoints</td></tr>
 
<tr><th>FILE=filename</th>
<tr><th><var>CHKP</var></th>
<td>include only users with '''filename''' open.</td></tr>
<td>Include only users preventing checkpoints.</td></tr>
<tr><th>IODEV=iodevnum</th>
 
<td>include only users on IODEV '''iodevnum'''.</td></tr>
<tr><th><var>FILE=</var>filename</th>
<tr><th>PNAME=pname</th>
<td>Include only users with <var class="term">filename</var> open.</td></tr>
<td>include only users running procedures with names matching '''termid''' (wildcards allowed).</td></tr>
 
<tr><th>SUBSYS=subsysid</th>
<tr><th><var>IODEV=</var>iodevnum</th>
<td>include only users in subsystem '''subsysid''' (wildcards allowed).</td></tr>
<td>Include only users on IODEV <var class="term">iodevnum</var>.</td></tr>
<tr><th>TERMID=termid</th>
 
<td>include only users logged on terminals with ids matching '''termid''' (wildcards allowed).</td></tr>
<tr><th><var>PNAME=</var>pname</th>
<tr><th>USER=userid</th>
<td>Include only users running procedures with names matching <var class="term">pname</var> (wildcards allowed).</td></tr>
<td>include only users with userids matching '''userid''' (wildcards allowed).</td></tr>
 
<tr><th>WHAT=activity</th>
<tr><th><var>SUBSYS=</var>subsysid</th>
<td>include only users with current activity matching '''activity''' (wildcards allowed).
<td>Include only users in subsystem <var class="term">subsysid</var> (wildcards allowed).</td></tr>
 
<tr><th><var>TERMID=</var>termid</th>
<td>Include only users logged on terminals with ids matching <var class="term">termid</var> (wildcards allowed).</td></tr>
 
<tr><th><var>USER=</var>userid</th>
<td>Include only users with userids matching <var class="term">userid</var> (wildcards allowed).</td></tr>
 
<tr><th><var>WHAT=</var>activity</th>
<td>Include only users with current activity matching <var class="term">activity</var> (wildcards allowed).
</td></tr></table>
</td></tr></table>
In actual fact, all users are always included in the output list, but the excluded users have the high order bit of their user numbers turned on. This tells $StatLD to exclude the users from the difference $list.
 
==Syntax==
In actual fact, all users are always included in the output list, but the excluded users have the high order bit of their user numbers turned on. This tells <var>[[$StatLD]]</var> to exclude the users from the difference $list.</td></tr>
<p class="syntax"><section begin="syntax" /> %RESULT = $UsStatL(list_identifier, stat_list, criterion)
</table>
<section end="syntax" /></p>
 
<p class="caption">$UsStatL Function
===Error codes===
<p class="code"> -1 &mdash; User is not waiting. (The wait type of a running user is -1.)
-3 &mdash; No room to create $list items (if LISTFC <var>$SirParm</var> parameter not set).
-5 &mdash; Required parameter not specified.
-6 &mdash; Invalid $list identifier.
-12 &mdash; invalid stat name.
-13 &mdash; STAT not linked in.
-16 &mdash; Invalid selection criterion.
</p>
</p>
<p class="caption">%RESULT is a either a positive number, which is the milliseconds since the online was brought up, or a negative error code.</p>
<p class="code">
-3 - No room to create $list items
(if LISTFC $SirParm parameter not set)
-5 - Required parameter not specified
-6 - Invalid $list identifier
-13 - STAT not linked in
-16 - Invalid selection criterion
</p>
<p class="caption">$UsStatL return codes
</p>


The following program displays some statistics for all users in subsystem SIRMON.
==Example==
<p class="code"> b
The following program displays some statistics for all users in subsystem <code>SIRMON</code>.
<p class="code">b
   
   
%data is string len 255
%data is string len 255
%list1 = $ListNew
%list1 = $ListNew
%list2 = $ListNew
%list2 = $ListNew
%list3 = $ListNew
%list3 = $ListNew
   
   
%time1 = $UsStatL(%list1, 'IODEV CPU')
%time1 = $UsStatL(%list1, 'IODEV CPU')
Pause 1
Pause 1
%time2 = $UsStatL(%list2, 'IODEV CPU','SUBSYS=SIRMON')
%time2 = $UsStatL(%list2, 'IODEV CPU','SUBSYS=SIRMON')
%rc = $StatLD(%list1, %list2, %list3, 'N N', %time2 - %time1)
%rc = $StatLD(%list1, %list2, %list3, 'N N', %time2 - %time1)
   
   
For %i from 1 to $ListCnt(%list3)
For %i from 1 to $ListCnt(%list3)
%data = $ListInf(%list3, %i)
  %data = $ListInf(%list3, %i)
Text
  Text
userid = { $substr(%data,1,10) } -
      userid = { $substr(%data,1,10) } -
usernum = { $unbin($substr(%data,11,2)) } -
      usernum = { $unbin($substr(%data,11,2)) } -
iodev = { $unbin($substr(%data,13,4)) } -
      iodev = { $unbin($substr(%data,13,4)) } -
cpu total = { $unbin($substr(%data,17,4)) }
      cpu total = { $unbin($substr(%data,17,4)) }
End Text
  End Text
End For
End For
   
   
End
End
</p>
</p>
<p class="code">
<ul>
<li>&SFUNC
</ul>
</p>
<p class="caption">Products authorizing $UsStatL
</p>


[[Category:$Functions|$UsStatL]]
[[Category:$Functions|$UsStatL]]

Latest revision as of 11:14, 28 February 2018

Retrieve statistics for set of users into $list

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $UsStatL function is the UserStatistics class.

Syntax

%result = $UsStatL(list_identifier, stat_list, [criterion])

Syntax terms

%result Either a positive number, which is the milliseconds since the Online was brought up, or a negative error code.
list_identifier The identifier of the $list to receive the results. The current contents of the $list are deleted and replaced with the requested statistics. The format of each $list item is:
Byte 1-10 Blank padded userid
Byte 11-12 Binary user number
Byte 13- Returned statistics
stat_list A string of blank delimited words indicating the statistics to be returned. The length of each returned statistic is always a multiple of 4 bytes. This facilitates the use of $StatLD with the returned $list. For more information about available statistics, see User statistics displayed in SirMon.
criterion A selection criterion that indicates which users are to be included in the output $list. The following criteria are allowed:
ACCOUNT=acctid Include only users with account IDs matching acctid (wildcards allowed).
CFR=fid Include only users holding or requesting critical file resources in files with filename matching fid (wildcards allowed).
CHKP Include only users preventing checkpoints.
FILE=filename Include only users with filename open.
IODEV=iodevnum Include only users on IODEV iodevnum.
PNAME=pname Include only users running procedures with names matching pname (wildcards allowed).
SUBSYS=subsysid Include only users in subsystem subsysid (wildcards allowed).
TERMID=termid Include only users logged on terminals with ids matching termid (wildcards allowed).
USER=userid Include only users with userids matching userid (wildcards allowed).
WHAT=activity Include only users with current activity matching activity (wildcards allowed).
In actual fact, all users are always included in the output list, but the excluded users have the high order bit of their user numbers turned on. This tells $StatLD to exclude the users from the difference $list.

Error codes

-1 — User is not waiting. (The wait type of a running user is -1.) -3 — No room to create $list items (if LISTFC $SirParm parameter not set). -5 — Required parameter not specified. -6 — Invalid $list identifier. -12 — invalid stat name. -13 — STAT not linked in. -16 — Invalid selection criterion.

Example

The following program displays some statistics for all users in subsystem SIRMON.

b %data is string len 255 %list1 = $ListNew %list2 = $ListNew %list3 = $ListNew %time1 = $UsStatL(%list1, 'IODEV CPU') Pause 1 %time2 = $UsStatL(%list2, 'IODEV CPU','SUBSYS=SIRMON') %rc = $StatLD(%list1, %list2, %list3, 'N N', %time2 - %time1) For %i from 1 to $ListCnt(%list3) %data = $ListInf(%list3, %i) Text userid = { $substr(%data,1,10) } - usernum = { $unbin($substr(%data,11,2)) } - iodev = { $unbin($substr(%data,13,4)) } - cpu total = { $unbin($substr(%data,17,4)) } End Text End For End