$View

From m204wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The $View function returns:

  • The value of a parameter (system, file, or user) to the request.
  • File parameters.

    While $View works for all viewable parameters in local context, it does not work for some file parameters in remote context.

  • The size and use of journal and checkpoint streams.


Syntax to view a parameter value

The format of the $View function to view parameter values is:

%string = $View(parameter[, name])

Where:

  • parameter is a character string that represents the name of a viewable Model 204 parameter or other information. For example:

    $view('ERASE')

    returns a value of @ if the ERASE parameter is set to the character @. If the parameter name is invalid or the user is not authorized to display parameter values for the file, a null string is returned.

  • name overrides the default file or group context for the function. The format for this argument is:

    [[FILE | [PERM | TEMP] GROUP] name | $Curfile | $Update] [AT location]

    If this argument is omitted or null, the default context is the context of the statement containing the function. Thus, a default context is required for this function.

    You can specify $Curfile as the name argument in place of a file/group name.

Viewing file-specific information

In addition to viewable parameters, the following file-specific information can also be viewed with $View:

Name used with $View Description
DTSLBOPR

Date and time transaction was backed out during roll forward (for TBO files)

Date and time partial transaction was applied during roll forward (for non-TBO files)

DTSLCHKP Date and time of last checkpoint rolled back to (blank if file has also been rolled forward)
DTSLRCVY Date and time of last recovery
DTSLUPDT Date and time of last update
DTSLDKWR Date and time of last DKWR
DTSLRFWD Date and time of last roll forward
FIWHEN Date and time FISTAT was reset
FIWHO Terminal ID that reset FISTAT

For example:

$View ('FIWHEN')

The result is:

FIWHEN 94.257 SEP 14 16.40.45. DATE AND TIME FISTAT WAS RESET

Syntax for viewing statistics fields

%string = $View(category, field-to-return)

Where:

  • category is SLSTATS, SYSSTATS, or USRSTATS.
  • field-to-return is the name of the statistic field to return. See Description of statistics for the names of the statistics fields.

The following categories and fields are valid:

Valid categories and fields with $View
Category Statistics field to return Equivalent-to or returns-value-of Remarks
SLSTATS USERID $Userid Padded with blank spaces to 10 bytes
SLSTATS ACCOUNT $Account Padded to 10 bytes
SLSTATS SUBSYSTEM $Subsys with no argument Padded to 10 bytes
SLSTATS LAST LAST=field EVAL etc.
SLSTATS PROC-FILE Current procedure file Padded to 8 bytes
SLSTATS PROC Current procedure Variable length, or truncated to 21 bytes
SLSTATS since-last statistics name Statistics field  
SYSSTATS system stat name Statistics field  
SYSSTATS DKBM stat name Statistics field  
USRSTATS user stat name Statistics field  
USRSTATS conflict ctr name Statistics field  

Usage

  • In some cases (for example, CPU time), calculating the value of a statistic is a somewhat expensive operation, so $View does not force an update of its value.

    Since the $Stat function does update statistics when it is issued, you might try calling $Stat prior to invoking $View.

    In addition, the UserStatistics class allows collection of all user statistics at once, and it has methods for calculating differences between before and after snapshots and for converting statistics to XML or to audit-trail-style stat=value format. Like $Stat, a UserStatistics constructor forces updating of all the relevant statistics.

  • The time-related Since Last statistics fields, CNCT, CPU, SCHDCPU, and STCPU, are not valid during evaluation time.

    Specifying an invalid statistics field name returns a null value with the message:

    M204.1463: INVALID PARAMETER: fieldname

Syntax to view the size and use of journal and checkpoint streams

The format of $View for the use and size of journal and checkpoint streams is:

%string = $View('CCAJRNL'|'CCAJLOG'|'CHKPOINT'|'CHKPNTS')

$View returns a string that describes the usage of the specified stream with the following character format:

Describes LENGTH Displays
In use DDNAME 8 Alphanumeric characters
Percentage used 4 Integer with percentage sign
Maximum size 9 Number of tracks
Current size 9 Number of tracks
Unused spaces 2 Number of tracks
VOLSER 6 Alphanumeric characters
Separating back slash 1 A back slash
Data set name Variable Data set name
Separating back slash 1 A back slash
Generation number Variable Generation number with a leading plus sign

You must ensure that the %variable being used to hold the requested information is defined as STRING LEN 80 or greater. For example:

BEGIN %STRING IS STRING LEN 80 %STRING = $VIEW('CCAJRNL') PRINT %STRING END

This returns:

CCAJRNL 0% 37 0 0SU000\OHIO1.ONLINE.JOURNAL