$Context
Determine if string is name of open file or group
Note: Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $Context function.
$Context 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.
Syntax
%result = $Context(fgname)
%result | A numeric variable that is set to indicate the success of the function:
0 - String does not specify an open file or group 1 - String specifies an open group 2 - String specifies an open file |
---|---|
fgname | The name to be tested. This name can be either of these:
If fgname 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: The last example is not fully qualified, so $Context first looks for a temporary group, 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. |
Examples
- In the following example,
%rc
is set to 1 if fileKRUSTY
is open:%rc = $Context( 'FILE KRUSTY' )
- In the following example,
%rc
is set to 1 ifBURNS
identifies an open file, 2 ifBURNS
identifies an open group, and 0 if it identifies neither:%rc = $Context( 'BURNS' )
- In the following example,
%rc
is set to 2 ifNUKEM
is open as a temporary group, and set to 0 otherwise:%rc = $Context( 'TEMP GROUP NUKEM' )