RAD function: simple.file.load

A RAD function that loads an unload file containing only data records of one file into a target file. If the target file already exists it will either drop the target file first, or return an error based on a flag passed as a parameter.

This function only works with binary unload files. Text unload files are not supported.

Caution Due to the limited capabilities of this routine and the potential loss of data, this function should not be used except by system RAD routines such as the upgrade.

Function

simple.file.load()

Format

$L.rc=simple.file.load( <unload file name>, <target file name>, <drop if already exists flag> )

Function returns

true - if successful.

false - if there was a failure.

Parameters

The following parameters are valid for the simple.file.load function:

Parameter Data type Description
unload file name character Specifies where the unload file is located
target file name character Specifies the target file for this function, for example, signatures. As a safety precaution, this file name has to match the dbdict record internally stored in the unload file, or the function returns an error.
drop if already exists logical Controls the behavior of the function if the target file already exists. If set to FALSE, the function will fail and return an error if the target file already exists in the system. If set to TRUE, the function will drop the existing target file first, before recreating it based on the dbdict record stored in the unload file.

Example

$L.result=simple.file.load( "C:\\Temp\\my_signatures.unl", "signatures", false )

This example attempts to load the unload file C:\Temp\my_signatures.unl into the signatures file. It will fail if the signatures file already exists (third parameter is false).

Note The escape characters have to be escaped.