$View
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:
| 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
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