$Close: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:


===Status codes===
===Status codes===
The <var>$Close</var> function operates like the <var>[[CLOSE command]]</var>, only it allows you to close a file from within a <var class="product">User Language</var> request.  <var>$Close</var> has some restrictions, which are listed below among the non-0 values of the returned <var class="term">%result</var>.  Basically, you cannot close a file or group that has requests compiled against it, has currently included procedures, or is a non-optional subsystem file or group:
<p class="code">  
<p class="code">  
  0 - File/group closed
  0 - File/group closed

Revision as of 13:43, 6 May 2013

Close file or group in User Language request

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currently no OO equivalent for the $Close function.

The $Close function allows a user to close a file or group from within a User Language request.

$Close accepts one argument and returns a numeric code. It is also callable.

Syntax

%result = $Close(fgname)

%result is set to indicate the success of the function.

The only argument is the name of the file or group to be closed. This name can be either an unqualified name, in which case the standard 204 search order (TEMP GROUP, PERM GROUP, FILE) will be used to try to identify the file or group; or it can be a qualified name that explicitly indicates whether $Close is to act on a file or group. Some examples of qualified names are :

'TEMP GROUP FOO' 'FILE HOHO' 'PERM GROUP CHUCKLES' 'GROUP KRUSTY'

Note that the last example is not fully qualified so that $Close will first look for a temporary group and then a permanent group.

Status codes

The $Close function operates like the CLOSE command, only it allows you to close a file from within a User Language request. $Close has some restrictions, which are listed below among the non-0 values of the returned %result. Basically, you cannot close a file or group that has requests compiled against it, has currently included procedures, or is a non-optional subsystem file or group:

0 - File/group closed 1 - File/group name missing 2 - File/group not open 3 - Can't close because of INCLUDE'd proc 4 - Can't close because compiled code accesses file/group 5 - Can't close required subsystem member 6 - Can't close member of open temp group

Example

The following program closes file 'KRUSTY'.

B %RC = $Close( 'KRUSTY' ) END