$UsStatL: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Retrieve statistics for set of users into $list</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. There is no OO equivalent for the $UsStatL function.</p> | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the <var>$UsStatL</var> function.</p> | ||
This function allows retrieval of statistics for a set of users into a $list. | This function allows retrieval of statistics for a set of users into a $list. | ||
The $UsStatL function accepts three arguments and returns a numeric error code. | The <var>$UsStatL</var> function accepts three arguments and returns a numeric error code. | ||
==Syntax== | |||
<p class="syntax"><section begin="syntax" />%result = $UsStatL(list_identifier, stat_list, criterion) | |||
<section end="syntax" /></p> | |||
===Syntax terms=== | |||
<table class="syntaxTable"> | |||
<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> | |||
<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: | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
Line 19: | Line 29: | ||
</td></tr> | </td></tr> | ||
</table> | </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 $StatLD with the returned $list. For more information about available statistics, see the <var class="product">[http://sirius-software.com/maint/download/monr.pdf SirMon User's Guide]</var>. </td></tr> | |||
<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: | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>ACCOUNT=acctid</th> | <tr><th>ACCOUNT=acctid</th> | ||
<td>include only users with account ids matching | <td>include only users with account ids matching <var class="term">acctid</var> (wildcards allowed).</td></tr> | ||
<tr><th>CFR=fid</th> | <tr><th>CFR=fid</th> | ||
<td>include only users holding or requesting critical file resources in files with filename matching | <td>include only users holding or requesting critical file resources in files with filename matching <var class="term">fid</var> (wildcards allowed).</td></tr> | ||
<tr><th>CHKP</th> | <tr><th>CHKP</th> | ||
<td>include only users preventing checkpoints</td></tr> | <td>include only users preventing checkpoints</td></tr> | ||
<tr><th>FILE=filename</th> | <tr><th>FILE=filename</th> | ||
<td>include only users with | <td>include only users with <var class="term">filename</var> open.</td></tr> | ||
<tr><th>IODEV=iodevnum</th> | <tr><th>IODEV=iodevnum</th> | ||
<td>include only users on IODEV | <td>include only users on IODEV <var class="term">iodevnum</var>.</td></tr> | ||
<tr><th>PNAME=pname</th> | <tr><th>PNAME=pname</th> | ||
<td>include only users running procedures with names matching | <td>include only users running procedures with names matching <var class="term">pname</var> (wildcards allowed).</td></tr> | ||
<tr><th>SUBSYS=subsysid</th> | <tr><th>SUBSYS=subsysid</th> | ||
<td>include only users in subsystem | <td>include only users in subsystem <var class="term">subsysid</var> (wildcards allowed).</td></tr> | ||
<tr><th>TERMID=termid</th> | <tr><th>TERMID=termid</th> | ||
<td>include only users logged on terminals with ids matching | <td>include only users logged on terminals with ids matching <var class="term">termid</var> (wildcards allowed).</td></tr> | ||
<tr><th>USER=userid</th> | <tr><th>USER=userid</th> | ||
<td>include only users with userids matching | <td>include only users with userids matching <var class="term">userid</var> (wildcards allowed).</td></tr> | ||
<tr><th>WHAT=activity</th> | <tr><th>WHAT=activity</th> | ||
<td>include only users with current activity matching | <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. | 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.</td></tr> | ||
</table> | |||
< | |||
<p class="code"> | ===Error codes=== | ||
<p class="code"> -3 - No room to create $list items | |||
(if LISTFC <var>$SirParm</var> parameter not set) | |||
-5 - Required parameter not specified | |||
-6 - Invalid $list identifier | |||
-13 - STAT not linked in | |||
-16 - Invalid selection criterion | |||
</p> | </p> | ||
==Example== | |||
The following program displays some statistics for all users in subsystem SIRMON. | The following program displays some statistics for all users in subsystem SIRMON. | ||
<p class="code"> b | <p class="code">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 | |||
</p> | </p> | ||
Revision as of 21:17, 24 October 2012
Retrieve statistics for set of users into $list
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $UsStatL function.
This function allows retrieval of statistics for a set of users into a $list.
The $UsStatL function accepts three arguments and returns a numeric error code.
Syntax
<section begin="syntax" />%result = $UsStatL(list_identifier, stat_list, criterion) <section end="syntax" />
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:
| ||||||||||||||||||||
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 the SirMon User's Guide. | ||||||||||||||||||||
criterion | A selection criterion that indicates which users are to be included in the output $list. The following criteria are allowed:
|
Error codes
-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
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