$View: Difference between revisions
No edit summary |
m (add info re $Stat and UserStatistics class) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<p>The $ | <p> | ||
The <var>$View</var> function returns:</p> | |||
<ul> | <ul> | ||
<li>The value of a parameter (system, file, or user) to the request</li> | <li>The value of a parameter (system, file, or user) to the request.</li> | ||
<li>File parameters. | |||
<p>While <var>$View</var> works for all viewable parameters in local context, it does not work for some file parameters in remote context.</p> | |||
</li> | </li> | ||
< | <li>The size and use of journal and checkpoint streams.</li> | ||
</ul><br /> | |||
</ | ==Syntax to view a parameter value== | ||
</ | <p> | ||
The format of the <var>$View</var> function to view parameter values is: </p> | |||
<p>The format of the $ | <p class="syntax"><span class="term">%string</span> = $View(<span class="term">parameter</span>[, <span class="term">name</span>]) | ||
<p class=" | |||
</p> | </p> | ||
<p> | <p>Where:</p> | ||
<ul> | <ul> | ||
<li>parameter is a character string that represents the name of a viewable <var class="product">Model 204</var> parameter or other information. For example: | <li><var class="term">parameter</var> is a character string that represents the name of a viewable <var class="product">Model 204</var> parameter or other information. For example: | ||
<p class="code">$ | <p class="code">$view('ERASE') | ||
</p> | </p> | ||
<p>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.</p> | <p> | ||
returns a value of <code>@</code> if the <var>ERASE</var> parameter is set to the character <code>@</code>. If the parameter name is invalid or the user is not authorized to display parameter values for the file, a null string is returned.</p> | |||
</li> | </li> | ||
<li><var class="term">name</var> overrides the default file or group context for the function. The format for this argument is: | |||
<p class="syntax">[[FILE | [PERM | TEMP] GROUP] <span class="term">name</span> | $Curfile | $Update] [AT <span class="term">location</span>] | |||
</p> | </p> | ||
<p>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.</p> | <p> | ||
<p>You can specify $ | 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.</p> | ||
<p> | |||
You can specify <var>[[$Curfile]]</var> as the <span class="term">name</span> argument in place of a file/group name. </p> | |||
</li> | </li> | ||
</ul> | </ul> | ||
<p>In addition to viewable parameters, the following file-specific information can also be viewed with $ | ==Viewing file-specific information== | ||
<p> | |||
In addition to viewable parameters, the following file-specific information can also be viewed with <var>$View</var>:</p> | |||
<table> | <table> | ||
<tr class="head"> | <tr class="head"> | ||
<th>Name used with $ | <th>Name used with $View</th> | ||
<th>Description</th> | <th>Description</th> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLBOPR</td> | <td>DTSLBOPR</td> | ||
Line 43: | Line 51: | ||
</td> | </td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLCHKP</td> | <td>DTSLCHKP</td> | ||
<td>Date and time of last checkpoint rolled back to | <td>Date and time of last checkpoint rolled back to (blank if file has also been rolled forward)</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLRCVY</td> | <td>DTSLRCVY</td> | ||
<td>Date and time of last recovery</td> | <td>Date and time of last recovery</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLUPDT</td> | <td>DTSLUPDT</td> | ||
<td>Date and time of last update</td> | <td>Date and time of last update</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLDKWR</td> | <td>DTSLDKWR</td> | ||
<td>Date and time of last DKWR</td> | <td>Date and time of last DKWR</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>DTSLRFWD</td> | <td>DTSLRFWD</td> | ||
<td>Date and time of last roll forward</td> | <td>Date and time of last roll forward</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>FIWHEN</td> | <td>FIWHEN</td> | ||
<td>Date and time FISTAT was reset</td> | <td>Date and time FISTAT was reset</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>FIWHO</td> | <td>FIWHO</td> | ||
Line 72: | Line 87: | ||
</tr> | </tr> | ||
</table> | </table> | ||
<p>For example:</p> | <p> | ||
<p class="code">$ | For example:</p> | ||
</p> | <p class="code">$View ('FIWHEN')</p> | ||
<p> | <p> | ||
<p class=" | The result is:</p> | ||
</p> | <p class="output">FIWHEN 94.257 SEP 14 16.40.45. DATE AND TIME FISTAT WAS RESET</p> | ||
< | ==Syntax for viewing statistics fields== | ||
< | <p class="syntax"><span class="term">%string</span> = $View(<span class="term">category</span>, <span class="term">field-to-return</span>)</p> | ||
</ | <p>Where: </p> | ||
<p> | <ul> | ||
<li><var class="term">category</var> is <var>SLSTATS</var>, <var>SYSSTATS</var>, or <var>USRSTATS</var>. </li> | |||
<li><var class="term">field-to-return</var> is the name of the statistic field to return. See [[Using system statistics#Description of statistics|Description of statistics]] for the names of the statistics fields.</li> | |||
</ul> | |||
<p> | |||
The following categories and fields are valid:</p> | |||
<table> | <table> | ||
<caption>Valid categories and fields with $ | <caption>Valid categories and fields with $View</caption> | ||
<tr class="head"> | <tr class="head"> | ||
<th> | <th>Category</th> | ||
Category</th> | <th>Statistics field to return</th> | ||
<th>Statistics field | <th>Equivalent-to or returns-value-of</th> | ||
<th> | <th>Remarks</th> | ||
Equivalent-to or returns-value-of</th> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>USERID</td> | ||
<td>[[$Userid]]</td> | <td><var>[[$Userid]]</var></td> | ||
<td>Padded with blank spaces to 10 bytes</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>ACCOUNT</td> | ||
<td>[[$Account]]</td> | <td><var>[[$Account]]</var></td> | ||
<td>Padded to 10 bytes</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>SUBSYSTEM</td> | ||
<td>$ | <td><var>$Subsys</var> with no argument</td> | ||
<td>Padded to 10 bytes</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>LAST</td> | ||
<td>LAST=field</td> | <td>LAST=field</td> | ||
<td>EVAL etc.</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>PROC-FILE</td> | ||
<td>Current procedure file</td> | <td>Current procedure file</td> | ||
<td>Padded to 8 bytes</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>PROC</td> | ||
<td>Current procedure </td> | <td>Current procedure</td> | ||
<td>Variable length, or truncated to 21 bytes</td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SLSTATS</td> | ||
<td> | <td>since-last statistics name</td> | ||
<td>Statistics field</td> | <td>Statistics field</td> | ||
<td> </td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SYSSTATS</td> | ||
<td> | <td>system stat name</td> | ||
<td>Statistics field</td> | <td>Statistics field</td> | ||
<td> </td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>SYSSTATS</td> | ||
<td> | <td>DKBM stat name</td> | ||
<td>Statistics field</td> | <td>Statistics field</td> | ||
<td> </td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>USRSTATS</td> | ||
<td> | <td>user stat name</td> | ||
<td>Statistics field</td> | <td>Statistics field</td> | ||
<td> </td> | |||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> | <td>USRSTATS</td> | ||
<td> | <td>conflict ctr name</td> | ||
<td>Statistics field</td> | <td>Statistics field</td> | ||
<td> </td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
< | |||
<p>The time related Since Last statistics fields, CNCT, CPU, SCHDCPU, and STCPU, are not valid during evaluation time.< | ===Usage=== | ||
<ul> | |||
<p class="code">M204.1463: INVALID PARAMETER: fieldname | <li>In some cases (for example, CPU time), calculating the value of a statistic is a somewhat expensive operation, so <var>$View</var> does not force an update of its value. | ||
</ | <p> | ||
< | Since the <var>$Stat</var> function <i>does</i> update statistics when it is issued, you might try calling <var>$Stat</var> prior to invoking <var>$View</var>.</p> | ||
<p>The format of $ | <p> | ||
<p class=" | 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 <code><i>stat</i>=<i>value</i></code> format. Like <var>$Stat</var>, a <var>UserStatistics</var> constructor forces updating of all the relevant statistics.</p></li> | ||
<li>The time-related Since Last statistics fields, CNCT, CPU, SCHDCPU, and STCPU, are not valid during evaluation time. | |||
<p> | |||
</p> | Specifying an invalid statistics field name returns a null value with the message:</p> | ||
<p>$ | <p class="code">M204.1463: INVALID PARAMETER: <i>fieldname</i></p> | ||
</li> | |||
</ul> | |||
==Syntax to view the size and use of journal and checkpoint streams== | |||
<p> | |||
The format of <var>$View</var> for the use and size of journal and checkpoint streams is:</p> | |||
<p class="syntax"><span class="term">%string</span> = $View('CCAJRNL'|'CCAJLOG'|'CHKPOINT'|'CHKPNTS')</p> | |||
<p> | |||
<var>$View</var> returns a string that describes the usage of the specified stream with the following character format:</p> | |||
<table> | <table> | ||
<tr> | <tr class="head"> | ||
<td>Describes </td> | <td>Describes</td> | ||
<td>LENGTH </td> | <td>LENGTH</td> | ||
<td>Displays</td> | <td>Displays</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>In use DDNAME</td> | <td>In use DDNAME</td> | ||
Line 172: | Line 225: | ||
<td>Alphanumeric characters</td> | <td>Alphanumeric characters</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Percentage used </td> | <td>Percentage used </td> | ||
Line 177: | Line 231: | ||
<td>Integer with percentage sign</td> | <td>Integer with percentage sign</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Maximum size </td> | <td>Maximum size </td> | ||
Line 182: | Line 237: | ||
<td>Number of tracks</td> | <td>Number of tracks</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Current size </td> | <td>Current size </td> | ||
Line 187: | Line 243: | ||
<td>Number of tracks</td> | <td>Number of tracks</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Unused spaces </td> | <td>Unused spaces </td> | ||
Line 192: | Line 249: | ||
<td>Number of tracks</td> | <td>Number of tracks</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>VOLSER </td> | <td>VOLSER </td> | ||
Line 197: | Line 255: | ||
<td>Alphanumeric characters</td> | <td>Alphanumeric characters</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Separating back slash </td> | <td>Separating back slash </td> | ||
Line 202: | Line 261: | ||
<td>A back slash</td> | <td>A back slash</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Data set name</td> | <td>Data set name</td> | ||
Line 207: | Line 267: | ||
<td>Data set name</td> | <td>Data set name</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Separating back slash</td> | <td>Separating back slash</td> | ||
Line 212: | Line 273: | ||
<td>A back slash</td> | <td>A back slash</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>Generation number </td> | <td>Generation number </td> | ||
Line 218: | Line 280: | ||
</tr> | </tr> | ||
</table> | </table> | ||
<p>You must ensure that the %variable being used to hold the requested information is defined as STRING LEN 80 or greater | <p> | ||
<p class="code">%STRING IS STRING LEN 80 | You must ensure that the %variable being used to hold the requested information is defined as <code>STRING LEN 80</code> or greater. For example:</p> | ||
<p class="code">BEGIN | |||
%STRING IS STRING LEN 80 | |||
%STRING = $VIEW('CCAJRNL') | %STRING = $VIEW('CCAJRNL') | ||
PRINT %STRING | PRINT %STRING | ||
END | END</p> | ||
CCAJRNL 0% 37 0 0SU000\OHIO1.ONLINE.JOURNAL | This returns: | ||
<p class="output">CCAJRNL 0% 37 0 0SU000\OHIO1.ONLINE.JOURNAL | |||
</p> | </p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Latest revision as of 22:10, 25 January 2016
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
- 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