Was this helpful?
CloseFile()
Closes a file.
Syntax
[returnfield = ] [callproc] closefile
  (handle = handle
  [, disposition = disposition] )
returnfield
Specifies the name of field to which the result is returned. Integer.
handle
Specifies the file identifier used by the 4GL file access functions. Handle is an integer.
disposition
Indicates whether the file is preserved or removed when it is closed. The value is 'delete' or 'keep', or a 4GL expression that evaluates to one of these values.
Description
The closefile() function closes a file that was previously opened with the openfile() function. You can delete the file when you close it by specifying the clause disposition = 'delete'. The default is to keep the file.
The procedure returns 0 if the function completes without error.
Example
Close the file with the handle "file_no", and check for errors:
Status = callproc closefile (handle = file_no, 
  disposition = 'keep');
 if status != 0 then
  message 'Unable to close file ' + ifnull(filename,' ')
  with style=popup;
  resume;
endif;
Last modified date: 08/14/2024