User Tools

Site Tools

Navigation:  Language Reference > 13 - Built-in Functions >====== APPEND (add a new file record) ====== Previous pageReturn to chapter overviewNext page

APPEND(file [,length])


APPEND Writes a new record to a FILE.
file The label of a FILE declaration.
length An integer constant, variable, or expression which contains the number of bytes to write to the file. The length must be greater than zero and not greater than the length of the RECORD. If omitted or out of range, length defaults to the length of the RECORD structure.

The APPEND statement writes a new record from the RECORD structure data buffer to the data file. No KEYs associated with the file are updated during an APPEND. After APPENDing records, the KEYs must be rebuilt with the BUILD command.

APPEND is usually used in batch processes, to speed the process of adding a large number of records at one time to the file. For most every file system, it is much faster to add 5000 records to a file using APPEND (and then issue BUILD atthe end of the process to rebuild all the keys at once) than it is to use ADD to add the same 5000 records (which automatically updates the keys with each new record added).

If an error is posted, no record is added to the file. If there is no room for the record on disk, the “Access Denied” error is posted.

Errors Posted:

05 Access Denied
37 File Not Open


LOOP                      !Process an input file

NEXT(InFile)             !getting each record in turn

IF ERRORCODE()           !break loop on error



Cus:Record = Inf:Record  !Copy the data to Customer file

APPEND(Customer)         !and APPEND a customer record

IF ERRORCODE()           !check for errors




BUILD(Customer)           !Re-build Keys

See Also:



append_add_a_new_file_record_.htm.txt · Last modified: 2021/04/15 15:56 (external edit)