$FiStat: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$FiStat}} | {{DISPLAYTITLE:$FiStat}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Retrieve file's statistics into string</span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $FiStat function.</p> | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $FiStat function.</p> |
Revision as of 21:21, 22 November 2011
Retrieve file's statistics into string
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $FiStat function.
This function allows retrieval of a specific file's statistics into a string.
The $FiStat 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 $StatD with the returned string. For more information on available statistics, see the "SirMon User's Guide".
The second argument is the file number of the file for which data is to be returned.
Syntax
<section begin="syntax" /> %STRING = $FiStat(stat_list, file_num) <section end="syntax" />
The data returned by $FiStat is binary, the first 4 bytes of which contain a return code. If the return code is negative, only 4 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 10 bytes contain the blank-padded file name, followed by 2 bytes that contain the binary file number. This means that the actual data starts at offset 16 (byte number 17) in the result string.
-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 - File no longer open
The following program displays some totals for file 0 (always CCATEMP).
B %DATA IS STRING LEN 255 %DATA = $FiStat('DKIO CFRCONF CFRQUEU', 0) IF $LEN(%DATA) = 4 THEN PRINT '$FISTAT ERROR... RC = ' WITH - $UNBIN(%DATA) STOP END IF PRINT 'FILENAME = ' WITH $SUBSTR(%DATA, 5, 10) PRINT 'DKIO = ' WITH - $UNBIN( $SUBSTR(%DATA, 17, 4) ) PRINT 'CFRCONF = ' WITH - $UNBIN( $SUBSTR(%DATA, 21, 4) ) PRINT 'CFRQUEU = ' WITH - $UNBIN( $SUBSTR(%DATA, 25, 4) ) END