$Context: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Determine if string is name of open file or group<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Determine if string is name of open file or group<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Context function.</p> | ||
The $Context function allows a user to determine if a string contains the name of an open file or group. | The $Context function allows a user to determine if a string contains the name of an open file or group. | ||
Line 14: | Line 14: | ||
<li>A qualified name that explicitly indicates whether $Context is to act on a file or group. | <li>A qualified name that explicitly indicates whether $Context is to act on a file or group. | ||
</ul> | </ul> | ||
If this name is not specified, the default file or group at compile time is used. | If this name is not specified, the default file or group at compile time is used. | ||
Line 24: | Line 23: | ||
'GROUP KRUSTY' | 'GROUP KRUSTY' | ||
</p> | </p> | ||
Note that the last example is not fully qualified, so $Context first looks for a temporary group and then a permanent group. If the specified entity is a file that is only open as a member of a group, $Context returns a 0 indicating that the file is not open as an individual file. | Note that the last example is not fully qualified, so $Context first looks for a temporary group and then a permanent group. If the specified entity is a file that is only open as a member of a group, $Context returns a 0 indicating that the file is not open as an individual file. | ||
Line 33: | Line 31: | ||
</p> | </p> | ||
<p class="caption">%RESULT is set to indicate the success of the function.</p> | <p class="caption">%RESULT is set to indicate the success of the function.</p> | ||
<p class="code"> | <p class="code"> | ||
0 - String does not specify an open file or group | 0 - String does not specify an open file or group | ||
Line 40: | Line 39: | ||
<p class="caption">$Context return codes | <p class="caption">$Context return codes | ||
</p> | </p> | ||
In the following example, %RC is set to 1 if file KRUSTY is open: | In the following example, %RC is set to 1 if file KRUSTY is open: | ||
Line 47: | Line 44: | ||
</p> | </p> | ||
In the following example, %RC is set to 1 if BURNS identifies an open file, 2 if BURNS identifies an open group, and 0 if it identifies neither: | |||
<p class="code"> %RC = $Context( 'BURNS' ) | <p class="code"> %RC = $Context( 'BURNS' ) | ||
</p> | </p> | ||
In the following example, %RC is set to 2 if NUKEM is open as a temporary group, and set to 0 otherwise: | |||
<p class="code"> %RC = $Context( 'TEMP GROUP NUKEM' ) | <p class="code"> %RC = $Context( 'TEMP GROUP NUKEM' ) | ||
</p> | </p> | ||
Line 72: | Line 67: | ||
<p class="caption">Products authorizing $Context | <p class="caption">Products authorizing $Context | ||
</p> | </p> | ||
[[Category:$Functions|$Context]] | [[Category:$Functions|$Context]] |
Revision as of 20:28, 31 January 2011
<section begin="desc" />Determine if string is name of open file or group<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Context function.
The $Context function allows a user to determine if a string contains the name of an open file or group.
$Context accepts one argument and returns a numeric code.
The only argument is the name to be tested. This name can be either:
- An unqualified name, in which case the standard Model 204 search order (TEMP GROUP, PERM GROUP, FILE) is used to identify the file or group.
- A qualified name that explicitly indicates whether $Context is to act on a file or group.
If this name is not specified, the default file or group at compile time is used.
Some examples of qualified names follow:
'TEMP GROUP FOO' 'FILE HOHO' 'PERM GROUP CHUCKLES' 'GROUP KRUSTY'
Note that the last example is not fully qualified, so $Context first looks for a temporary group and then a permanent group. If the specified entity is a file that is only open as a member of a group, $Context returns a 0 indicating that the file is not open as an individual file.
Syntax
<section begin="syntax" /> %RESULT = $Context(fgname) <section end="syntax" />
0 - String does not specify an open file or group 1 - String specifies an open group 2 - String specifies an open file
In the following example, %RC is set to 1 if file KRUSTY is open:
%RC = $Context( 'FILE KRUSTY' )
In the following example, %RC is set to 1 if BURNS identifies an open file, 2 if BURNS identifies an open group, and 0 if it identifies neither:
%RC = $Context( 'BURNS' )
In the following example, %RC is set to 2 if NUKEM is open as a temporary group, and set to 0 otherwise:
%RC = $Context( 'TEMP GROUP NUKEM' )