$FiStat

From m204wiki
Revision as of 17:50, 23 September 2016 by JAL (talk | contribs) (→‎Usage notes: remove item)
Jump to navigation Jump to search

Retrieve file's statistics into string

Note: 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.

Syntax

%string = $FiStat(stat_list, file_num)

Syntax terms

%string Binary data, the first 4 bytes of which is an error code. If the error code is negative, %string is only 4 bytes long.
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 File statistics displayed in SirMon.
file_num The file number of the file for which data is to be returned.

Usage notes

  • 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.

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 - File no longer open

Example

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

Products authorizing $FiStat