$Context: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (link repair)
 
(34 intermediate revisions by 5 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Determine if string is name of open file or group</span>
<span class="pageSubtitle">Determine if string is name of open file or group</span>


<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>
<p class="warn"><b>Note:</b> Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the <var>$Context</var> function.</p>


The <var>$Context</var> function allows a user to determine if a string contains the name of an open file or group.  
<var>$Context</var> allows a user to determine if a string contains the name of an open file or [[Files, groups, and reference context#File groups|group]].  


<var>$Context</var> accepts one argument and returns a numeric code.  
<var>$Context</var> accepts one argument and returns a numeric code.  


The only argument is the name to be tested. This name can be either:
==Syntax==
<p class="syntax"><span class="term">%result</span> = <span class="literal">$Context</span>(<span class="term">fgname</span>)
</p>
 
<table>
<tr><th>%result</th>
<td>A numeric variable that is set to indicate the success of the function:
<p class="code">0 - String does not specify an open file or group
1 - String specifies an open group
2 - String specifies an open file
</p></td></tr>
 
<tr><th>fgname</th>
<td>The name to be tested. This name can be either of these:
<ul>
<ul>
<li>An unqualified name, in which case the standard <var class="product">Model&nbsp;204</var> search order (TEMP GROUP, PERM GROUP, FILE) is used to identify the file or group. </li>


<li>An unqualified name, in which case the standard <var class="product">Model 204</var> search order (TEMP GROUP, PERM GROUP, FILE) is used to identify the file or group.
<li>A qualified name that explicitly indicates whether <var>$Context</var> is to act on a file or group. </li>
<li>A qualified name that explicitly indicates whether <var>$Context</var> is to act on a file or group.
</ul>
</ul>
 
<p>
If this name is not specified, the default file or group at compile time is used.  
If <var class="term">fgname</var> is not specified, the default file or group at compile time is used. </p>
 
<p>
Some examples of qualified names follow:
Some examples of qualified names follow: </p>
<p class="code"> 'TEMP GROUP FOO'
<p class="code">&apos;TEMP GROUP FOO'
'FILE HOHO'
&apos;FILE HOHO'
'PERM GROUP CHUCKLES'
&apos;PERM GROUP CHUCKLES'
'GROUP KRUSTY'
&apos;GROUP KRUSTY'  
</p>
 
Note that the last example is not fully qualified, so <var>$Context</var> 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, <var>$Context</var> returns a 0 indicating that the file is not open as an individual file.
==Syntax==
<p class="syntax"><section begin="syntax" />%result = $Context(fgname)
<section end="syntax" /></p>
<p class="caption">$Context Function
</p>
</p>
<p class="caption">%RESULT is set to indicate the success of the function.</p>
<p class="note"><b>Note:</b> The last example is not fully qualified, so <var>$Context</var> 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, <var>$Context</var> returns a 0 indicating that the file is not open as an individual file. </p></td></tr>
</table>


<p class="code">  
==Examples==
0 - String does not specify an open file or group
<ol>
1 - String specifies an open group
<li>In the following example, <code>%rc</code> is set to 1 if file <code>KRUSTY</code> is open:
2 - String specifies an open file
<p class="code">%rc = $Context( 'FILE KRUSTY' )
</p>
<p class="caption">$Context return codes
</p>
</p>


In the following example, %RC is set to 1 if file KRUSTY is open:
<li>In the following example, <code>%rc</code> is set to 1 if <code>BURNS</code> identifies an open file, 2 if <code>BURNS</code> identifies an open group, and 0 if it identifies neither:
<p class="code"> %RC = $Context( 'FILE KRUSTY' )
</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:
<li>In the following example, <code>%rc</code> is set to 2 if <code>NUKEM</code> 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>
</ol>


==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius Functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
<p class="caption">Products authorizing $Context
</p>


[[Category:$Functions|$Context]]
[[Category:$Functions|$Context]]

Latest revision as of 18:15, 27 April 2018

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:
  • 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 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

  1. In the following example, %rc is set to 1 if file KRUSTY is open:

    %rc = $Context( 'FILE KRUSTY' )

  2. 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' )

  3. 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' )

Products authorizing $Context