USFile internal component

Previous Next

The USFile internal component provides basic file-IO functionality. Text files can be kept open for a period longer than a single statement, making it possible to write to the file using multiple write statements. It is also possible to append the output of an XML.Export statement to a file which is opened with this USFile component.

Example

This script opens a file, writes data to it, then closes the file:

INVOKE   USFile.Open WITH
SELECT   'MyFile'
,        'c:\temp\myfile.xml'
,        'WRITE'  "Mode"
;
 
INVOKE   XML.Export WITH
SELECT   'MyFile' WriteOutputTo
       *
FROM     booking
WHERE    destination = 'AUSTRALIA'
;
 
INVOKE   USFile.Close WITH
SELECT   'MyFile'
;

The USFile component provides methods to:

Open a text file for reading, writing, or appending.

Write text or binary data to a file.

Read lines or a complete binary or text file.

Check if the end of a file has been reached when reading lines.

Close a file.

The USFile internal component has the following methods:

USFile.Close

USFile.EOF

USFile.Open

USFile.ReadBinaryFile

USFile.ReadLine

USFile.ReadTextFile

USFile.Write

USFile.WriteBinaryFile