8 File Storage
NOTE: The statements LOAD, GET, LINK, MERGE, {RE-}STORE and [RE-}SAVE can not be executed on the commandline of the IDE. This functions are implemeted in a different way. ( see section , The Integrated Development Environment (IDE), on page 68 )
STORE file spec [,ProtectCode] [;Option]
As an example, the following program line stores the program currently in memory onto the disk labeled PROGS under the name Life2:
210 STORE "Life2,PROGS"The volume label need not be included when addressing the default storage device.
This option simply specifies the Eloquence revision, the program format should be compatible to.
Example:
STORE "PrgName";"A.05.01"
Program options
Alternatively, you can specify a comma separated list of options and settings which should be used to store the program file. The following options are currently supported:
option | possible values | Comment |
---|---|---|
rev | A.xx.xx | Eloquence revision |
fmt | HP260 or "0" | Compatible format |
EXT or "1" | A.05.01 program format | |
TAG or "2" | A.06.00 program format |
Example:
STORE "PrgName";"rev=A.05.01" STORE "PrgName";"fmt=TAG" STORE "PrgName";"fmt=2"Error Messages
62 - File is protected or wrong protect code specified
66 - You are not authorized to store this program
RE-STORE file spec [,ProtectCode] [;Option]
LOAD file spec [,line id] [,ProtectCode]
The LOAD statement erases any program and data in memory and loads the program. Any information stored in common, however, is preserved if the loaded program has a COM statement. If the LOAD statement comes from the keyboard and no line id is specified, control returns to the keyboard after loading. If it comes from execution of a program line in memory, execution begins at the first line of the loaded program. When the line id is specified, however, execution of the loaded program begins at that line.
The program can only be loaded when the right protectcode is provided, otherwise an error 66 occures.
For example, the following program line loads the program in the previous example back into memory and execution then begins with line 20:
220 LOAD "Life2",20
LOAD SUB file spec [,starting line number[,increment] ]
[;starting segment [,last segment] ]
With no optional parameters, LOAD SUB loads all subprograms (both FN and SUB) from the specified program file. The starting segment and last segment parameters can be used to specify certain subprograms in the file. For example, if you wish to load only the third subprogram, specify LOAD SUB;3,3. An error occurs if either value is greater than the number of subprograms in the specified program file.
If the first line number in the subprogram is not greater than the last line of the current program in memory, the subprogram is automatically renumbered. The renumbering starts after the last line of the current program, in increments of ten. Another starting line number can be specified, if desired, but it must be greater than the last number of the current program. Another line-numbering increment can also be specified, if desired.
SAVE file spec [,beginning line id[,ending line id]]
The program is saved as string data, one program line per string. In this way, the file can be read, modified, or rewritten as string data by other programs.
When only the file spec is given, the entire program is saved. If the beginning line id is specified, the program is saved from that number to the end. If both line ids are specified, the program section from the beginning line id through the ending line id is saved.
The following example saves the program currently in memory, beginning with line 30, into a special data file named MONEY on the default storage device:
230 SAVE "MONEY",30As another example, this program line saves lines 50 through 250 into the special data file Prog1 on a disk named Software:
240 SAVE "Prog1,Software",50,250NOTE: The words "special data file" refer to a file that contains information on the maximum number of records, the length of records, and the number of records currently in the file.
NOTE: The STORE and LOAD operations are faster than SAVE and GET. STOREd programs are already coded in an internal format, while SAVEd programs must be coded before they can be executed.
GET file spec[,line id[,line id]]
If no line ids are specified, the GET statement erases any program and data in memory (except that associated with a COM statement), as it loads the specified file. Once the file is in memory, execution begins at the first line of the loaded program.
When one line id is specified, the loaded program is renumbered and executed starting with the specified line id. If a second line id is specified, the loaded program is renumbered starting with the first line id and is executed starting with the second line id. Any lower-numbered lines from a previous program are retained. The numbering remains the same on the storage medium.
Here is an example addressed to the default storage device:
250 GET "MONEY",50The file MONEY is retrieved and renumbered; any lower-numbered lines already in memory are retained. Execution of the program starts at line 50.
Listed below is another example:
260 GET "Prog1,Software",50,10This program is also renumbered with any lower-numbered lines being retained. Execution begins with line 10 already in memory.
NOTE: ERROR 18 occurring during a GET, LINK or MERGE operation indicates that a line being entered into memory is too long to be accepted (512 characters maximum).
NOTE: The STORE and LOAD operations are faster than SAVE and GET. STOREd programs are already coded in an internal format, while SAVEd programs must be coded before they can be executed.
LINK file spec [,line id [,line id]]
If no line ids are specified, the program is loaded, erasing the current program in memory.
The first line id specifies that the loaded program is to be renumbered and starts with the line number of the specified line. If two line ids are specified, execution begins with the second line specified.
In effect, GET performs a SCRATCH V operation on the new program, whereas LINK performs a CONT (continue) operation, involving no initialization of variables.
NOTE: ERROR 18 occurring during a GET, LINK or MERGE operation indicates that a line being entered into memory is too long to be accepted (512 characters maximum).
When no line ids are specified, the entire program is saved. When one line id is specified, the program is saved from that line to the end. When two line ids are specified, that block of lines is saved.
NOTE: The words "special data file" refer to a file that contains information on the length of records, the number of records currently in the file, and the maximum number of records defined for the file.
NOTE: The STORE and LOAD operations are faster than SAVE and GET. STOREd programs are already coded in an internal format, while SAVEd programs must be coded before they can be executed.
MERGE file spec [,line id [ ,line id ]]
If the first line id is specified, the program lines in the specified file are renumbered beginning with that line. The spacing between renumbered lines remains the same. The second line id specifies where program execution should begin.
To further explain the MERGE statement, suppose you have two files (OLD.DATA and NEW.DATA) and the line numbers in these files are as follows:
OLD.DATA NEW.DATA 1 10 2 20 3 30Listed below are three examples using the sample files. Each example shows a different MERGE statement and its result.
GET "OLD" GET "OLD" GET "NEW" MERGE "NEW" MERGE "NEW",100 MERGE "OLD",21 Result: Result: Result: 1 1 10 2 2 20 3 3 21 10 100 22 20 110 23 30 120 30NOTE: ERROR 18 occurring during a GET, LINK or MERGE operation indicates that a line being entered into memory is too long to be accepted (512 characters maximum).