$ItsOpen: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (needed a length)
m (replace lc "o")
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<p>The $ITSOPEN function lets you determine whether a file is open. $ITSOPEN only checks files, not groups of files. The return codes are: </p>
<p>
The <var>$ItsOpen</var> function lets you determine whether a file is open. <var>$ItsOpen</var> only checks files, not groups of files. The return codes are:</p>
<table>
<table>
<tr class="head">
<tr>
<th align="right">0</th>
<td>0</td>
<th>the file is not open</th>
<td>The file is not open.</td>
</tr>
</tr>
<tr>
<tr>
<td align="right">1</td>
<td>1</td>
<td>the file is open </td>
<td>The file is open.</td>
</tr>
</tr>
</table>
</table>
<b>Syntax</b>
<p>The format for the $ITSOPEN function is:</p>
<p class="code">$ITSOPEN({[FILE] name [AT location]


| [PERM | TEMP] [GROUP] name})
==Syntax==
<p>
The format for the <var>$ItsOpen</var> function is:</p>
<p class="syntax">$ItsOpen({[FILE] <span class="term">name</span> [AT <span class="term">location</span>] | [PERM | TEMP] [GROUP] <span class="term">name</span>})
</p>
</p>
<p>where name (optional) is a %variable or a literal name of the file or group. You <var class="term">must</var> enter the filename in uppercase. A file synonym name can also be used. If you do not enter a location (specifying a null argument), <var class="product">Model&nbsp;204</var> uses the reference context (at compile time) of the statement which calls the function.</p>
<p>
<b>Example</b>
where <var class="term">name</var> (optional) is a %variable or a literal name of the file or group. You <b>must</b> enter the filename in uppercase. A file synonym name can also be used. </p>
<p class="code">BEGIN
<p>
%FILE IS STRING LEN 8
If you do not enter a location (specifying a null argument), <var class="product">Model&nbsp;204</var> uses the reference context (at compile time) of the statement that calls the function.</p>
%FILE = $READ('ENTER THE FILENAME')
 
IF $ITSOPEN(%FILE) THEN
==Example==
     PRINT %FILE ' IS OPEN'
<p class="code">Begin
ELSE
%file Is String Len 8
     PRINT %FILE ' IS NOT OPEN'
%file = $read('ENTER THE FILENAME')
END
If $itsopen(%file) Then
     Print %file ' IS OPEN'
Else
     Print %file ' IS NOT OPEN'
End
</p>
</p>
==See also==
<ul>
<li><var>[[$Context]]</var>, which returns a number to indicate whether the context is a file or group.
</ul>
[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 16:36, 17 July 2017

The $ItsOpen function lets you determine whether a file is open. $ItsOpen only checks files, not groups of files. The return codes are:

0 The file is not open.
1 The file is open.

Syntax

The format for the $ItsOpen function is:

$ItsOpen({[FILE] name [AT location] | [PERM | TEMP] [GROUP] name})

where name (optional) is a %variable or a literal name of the file or group. You must enter the filename in uppercase. A file synonym name can also be used.

If you do not enter a location (specifying a null argument), Model 204 uses the reference context (at compile time) of the statement that calls the function.

Example

Begin %file Is String Len 8 %file = $read('ENTER THE FILENAME') If $itsopen(%file) Then Print %file ' IS OPEN' Else Print %file ' IS NOT OPEN' End

See also

  • $Context, which returns a number to indicate whether the context is a file or group.