Using “load table as” and “store table as” Options
The two commands load_table and store_table may be used to pick a table out of one DBfile, manipulate it, and store it in a second DBfile. The key to using these commands is to understand that tables are manipulated in the computer’s memory (also referred to as core).
The name that a table has while it is being manipulated in core does not have to be thesame name that it was originally created with, nor the name that will be used when it is stored.
The syntax is:
load table_name as string_variablestore table_name as string_variable
In most cases the string variable, mentioned above, will simply be a quoted string.
load t001 as "temp"
In words, the syntax of this load table command would be: Get the table named t001 and put it into core as temp.
The store command operates in the opposite direction.
For example:
store temp as "t001a"
In words the syntax of this store table command would be: Get the table in core named temp, and store it in the DBfile as t001a.
Usually you will want to use only one of these, since both have the ability to rename the table.
For example:
load t001 as "t001a", followed by: store t001a
These commands are most useful where more than one DBfile is involved, typically, using tables from one DBfile to create manipulated tables that will be stored in another DBfile.
The syntax: dbfile^entry allows one to store items into the DBfile of one’s choice when more than one DBfile is open read/write. Continuing with the example above, to get the tables from a DBfile named first.db and place the manipulated tables in a DBfile named second.db, you woulddo either of the following:
load first^t001 as "second^t001a"store second^t001aORload first^t001store first^t001 as "second^t001a"
Using the above technique one can make two DBfiles that contain the same table names, but different information. A good example of a use for this might be that the first DBfile contains information from the first wave of a study, and a second DBfile contains information fromthe second wave.
Example Spec:
~comment&loadstor.doc>createdb loadstor~deftabset={one:col=: total with dudrow=: [4^0/1//9]stub={:zeroonetwothreefourfivesixseveneightnine}}tabset={two=one:}tabset={three=one:}~setautotabtable_drop_mode=3~input bank~specfile loadstor~exctabset=onetabset=twotabset=threerunchain reset printall>createdb load2~clean>repeat $t=001,...,003load loadstor^t$t as "load2^t$t"m load2^t$t(2 by all) = loadstor^t$t(t by all) * 5store load2^t$t>endrepeat~specfile>resetdb>usedb loadstor>usedb load2>listdb loadstor>listdb load2~exc&loadstor.lpr~end