$SsStat: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (→‎Syntax: add "unsigned")
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$SsStat}}
{{DISPLAYTITLE:$SsStat}}
<span class="pageSubtitle"><section begin="desc" />Retrieve subsystem's statistics into string<section end="desc" /></span>
<span class="pageSubtitle">Retrieve subsystem's statistics into string</span>


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


This function allows retrieval of a specific subsystem's statistics into a string.  
This function allows retrieval of a specific subsystem's statistics into a string.  


The $SsStat function accepts two arguments and returns a string made up of an error code and returned statistics.
The first 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 $StatD with the returned string. For more information about available statistics, see the ''"SirMon User's Guide"''.
The second argument is the subsystem name for which data is to be returned.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %STRING = $SsStat(stat_list, subsystem_name)
<p class="syntax"><span class="term">%string</span> = <span class="literal">$SsStat</span>(<span class="term">stat_list</span>, <span class="term">subsystem_name</span>)
<section end="syntax" /></p>
<p class="caption">$SsStat Function
</p>
</p>
<p class="caption">%STRING is made up of binary data, the first 4 bytes of which is an error code. If the error code is negative, %STRING will only be 4 bytes long.</p>
<table>
<tr><th>%string</th>
<td>A string of data. If the string contains exactly four bytes, it is a binary [[#Return codes|error code]].
<p>
Otherwise, the first four bytes contain the unsigned binary number of milliseconds that the Online has been up. This provides a convenient number for calculating rates for the statistics. The next ten bytes contain the blank-padded file name, then follow two bytes containing the binary file number. This means that the actual statistical data starts at offset 16 (byte number 17) in the result string. </p></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>$StatD</var> with the returned string.
<p>
For more information about available statistics, see the <var class="product">[[SirMon]]</var> M204wiki pages. </p></td></tr>


The data returned by $SsStat is binary; the first four bytes contain a return code. If the return code is negative, only four bytes are returned. If the return code is positive, it contains a number of milliseconds that the online has been up. This provides a convenient number for calculating rates for the statistics. With a positive return code, the next ten bytes contain the blank padded file name, followed by two bytes containing the binary file number. This means that the actual data starts at offset 16 (byte number 17) in the result string.<p>
<tr><th>subsystem_name</th>
-5 - Required parameter not specified
<td>The name of the subsystem for which data is to be returned. </td></tr>
-12 - Invalid parameter (argument 2 > NUSERS,
</table>
or invalid name in stat_list)
 
-13 - STAT not linked in
===Return codes===
-14 - Result string would be longer than 255 bytes
<p class="code"> -5   Required parameter not specified
-15 - Subsystem not active
-12   Invalid parameter (argument 2 > NUSERS,
</p>
      or invalid name in stat_list)
<p class="caption">$SsStat return codes
-13   STAT not linked in
-14   Result string would be longer than 255 bytes
-15   Subsystem not active
</p>
</p>


==Example==
The following program displays some totals for subsystem <code>SIRMON</code>.


The following program displays some totals for subsystem SIRMON.
<p class="code">B
<p class="code"> B
   
   
%DATA IS STRING LEN 255
%DATA IS STRING LEN 255
   
   
%DATA = $SsStat('NUSER RESEVAL RESSWCH', 'SIRMON')
%DATA = $SsStat('NUSER RESEVAL RESSWCH', 'SIRMON')
IF $LEN(%DATA) = 4 THEN
IF $LEN(%DATA) = 4 THEN
PRINT '$SSSTAT ERROR... RC = ' WITH -
  PRINT '$SSSTAT ERROR... RC = ' WITH -
$UNBIN(%DATA)
  $UNBIN(%DATA)
STOP
  STOP
END IF
END IF
   
   
PRINT 'SUBSYSNAME = ' WITH $SUBSTR(%DATA, 5, 10)
PRINT 'SUBSYSNAME = ' WITH $SUBSTR(%DATA, 5, 10)
PRINT 'NUSER = ' WITH -
PRINT 'NUSER = ' WITH -
$UNBIN( $SUBSTR(%DATA, 17, 4) )
$UNBIN( $SUBSTR(%DATA, 17, 4) )
PRINT 'RESEVAL = ' WITH -
PRINT 'RESEVAL = ' WITH -
$UNBIN( $SUBSTR(%DATA, 21, 4) )
$UNBIN( $SUBSTR(%DATA, 21, 4) )
PRINT 'RESSWCH = ' WITH -
PRINT 'RESSWCH = ' WITH -
$UNBIN( $SUBSTR(%DATA, 25, 4) )
$UNBIN( $SUBSTR(%DATA, 25, 4) )
   
   
END
END
</p>
</p>
<p class="code">
<ul>
<li>&SFUNC


==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<li>[[List of $functions|Sirius functions]]
</ul>
</ul>
</p>
<p class="caption">Products authorizing $SsStat
</p>


[[Category:$Functions|$SsStat]]
[[Category:$Functions|$SsStat]]

Latest revision as of 14:53, 4 October 2016

Retrieve subsystem's statistics into string

Note: Many $functions have been deprecated in favor of Object Oriented methods. There is currently no OO equivalent for the $SsStat function.

This function allows retrieval of a specific subsystem's statistics into a string.

Syntax

%string = $SsStat(stat_list, subsystem_name)

%string A string of data. If the string contains exactly four bytes, it is a binary error code.

Otherwise, the first four bytes contain the unsigned binary number of milliseconds that the Online has been up. This provides a convenient number for calculating rates for the statistics. The next ten bytes contain the blank-padded file name, then follow two bytes containing the binary file number. This means that the actual statistical data starts at offset 16 (byte number 17) in the result string.

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 $StatD with the returned string.

For more information about available statistics, see the SirMon M204wiki pages.

subsystem_name The name of the subsystem for which data is to be returned.

Return codes

-5 Required parameter not specified -12 Invalid parameter (argument 2 > NUSERS, or invalid name in stat_list) -13 STAT not linked in -14 Result string would be longer than 255 bytes -15 Subsystem not active

Example

The following program displays some totals for subsystem SIRMON.

B %DATA IS STRING LEN 255 %DATA = $SsStat('NUSER RESEVAL RESSWCH', 'SIRMON') IF $LEN(%DATA) = 4 THEN PRINT '$SSSTAT ERROR... RC = ' WITH - $UNBIN(%DATA) STOP END IF PRINT 'SUBSYSNAME = ' WITH $SUBSTR(%DATA, 5, 10) PRINT 'NUSER = ' WITH - $UNBIN( $SUBSTR(%DATA, 17, 4) ) PRINT 'RESEVAL = ' WITH - $UNBIN( $SUBSTR(%DATA, 21, 4) ) PRINT 'RESSWCH = ' WITH - $UNBIN( $SUBSTR(%DATA, 25, 4) ) END

Products authorizing $SsStat