Eloquence Language Manual

8 File Storage

Data and programs can be stored and retrieved for later use. This chapter discusses the following statements and functions, associated with file storage and retrieval:

MASS STORAGE IS (MSI)
Specifies a default directory for successive file storage operations.
READ LABEL
Returns either the label of the directory currently in use or the labels of all volumes currently configured.
CAT
Lists the contents of a directory.
STORE
Creates a program file and records a program for later use.
LOAD
Copies a previously stored program into the computer memory.
LOAD SUB
Copies subprograms from a program file to the computer memory.
RE-STORE
Stores a program into an existing program file.
SAVE
Creates a special data file and stores a program as a series of strings.
GET
Gets data from a special data file and converts it into the computer memory as a program.
LINK
Same as GET, except all variable values are retained.
RESAVE
Saves program lines as a series of strings into an existing special data file.
MERGE
Inserts program lines from a file between lines currently in memory.
CREATE
Names and establishes a special data file or a regular data file.
ASSIGN
Opens a data file and assigns it a file number. Also used to close (de-assign) each data file.
PRINT#
Writes data into a data file.
READ#
Copies data from a data file into variables within a program.
ON END#
Branches to a recovery routine when an end-of-file (EOF) mark is detected during READ#.
OFF END#
Disables ON END#.
PURGE
Deletes a data file from the disk directory.
COPY
Duplicates the contents of one data file to another. Also for outputting the contents of a spool file to an output device.
RENAME
Assigns a new name to an existing data file.
LOCK# and UNLOCK#
Control access to specific data files in multi-user applications.
TYP
Determines the type of the next data item to be read (integer, string, etc.).
SIZE
Returns the size of a specified file.
REC
Returns the current position of the record pointer in a specified file.
WRD
Returns the current position of the word pointer for a specified file; use with direct-word access.
RESET# file number
Erases the contents of file to which the file number is ASSIGNED. File position is reset. Similar to purging and recreating the file. If this file is being used as a workfile, this will also reset workfile state. The file must be ASSIGNED either EXCLUSIVE (default ASSIGN) mode or must be locked in ASSIGNED in UPDATE mode.
Some functions are available for compatibility reasons, only. To get the syntax of this functions, see section , File Storage function, on page 2.

NOTE: The words "special data file" refer to a file that contains header information. The header consists of three lines of information. The first line tells the length of records currently in the file, the second tells the number of records currently in the file, and the third tells the maximum number of records defined for the file. This is different from a regular data file which contains ASCII data without any information about the file structure. Both special data files and regular data files have the extension .DATA.

If your application involves handling a large amount of data, consider using Eloquence DBMS (database management software). Database structures and operations are covered in the Eloquence DBMS Manual.

Chapter contents:

Syntax Terms
File Structure
The Default Mass Storage Device
Cataloging Files (CAT)
Using message Catalogs
Identifying Volume Labels
Storing and Retrieving Programs
Storaging and Retrieving Data
Creating a Data File
Opening a Data File
Serial Access
Direct Access
Direct Word Access
Storing and Retrieving Arrays
Closing a File
Purging a File
File Storage Functions
Trapping EOR and EOF Conditions
Data Storage Requirements
Multi-User File Protection
Copying a File
Renaming a File

Eloquence Language Manual - 19 DEC 2002