The ucreate command creates and opens a specified file on the host system.
UCREATE <path> TO FileHandle THEN statement(s) ELSE statement(s)
|File expressed by the valid path name, within quotes.
|Contains the file descriptor of the file that is open for write only.
If the file already exists, the ucreate command shortens the length of the file to 0. If the file does not exist, the ucreate command creates a new file. The file pointer is positioned at the beginning of the file. All future references to this file must be made through FileHandle. If an error occurs, the ELSE path executes.
The following example creates the \books\chap1.txt file. If the file exists, the ucreate command truncates the file to zero bytes. The file opens for reading/writing and the file descriptor is returned in the variable FILEDES. If an error occurs, the ELSE clause executes:
FILENAME="c:\books\chap1.txt" UCREATE FILENAME TO FILEDES ELSE PRINT "Unable to create and open ":FILENAME STOP END UCLOSE FILEDES ELSE STOP