Subject Re: DBase IV Commands
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 22 May 2016 08:32:37 +0200
Newsgroups dbase.getting-started

On 21/05/2016 18:55, Marilyn Price wrote:

> Actually, Ken, it's a little more complicated than that, as dBase IV
> didn't have any alter table commands.
>
> In a program:
> use oldtable
> copy to temp sdf
> copy structure to <some new name>

That should actually be

copy structure extended to <new name>

This created a four field table with fields
FIELD_NAME,FIELD_TYPE,FIELD_LEN and FIED_DEC.  The table had a record
for each field in the original table.

> use <some new name>
> locate for fieldname = "oldfieldname"
> replace fieldname with "newfieldname"

As you later pointed out one needed to create a new table from the
structure extended table before appending the data.  I can't remember if
this would overwrite the existing table or not. One probably had to
erase the old table first.

erase <original table name.dbf)

create <original table> from <new name>
use <original table.


> append from temp sdf


If one was changing field widths the data would need to be saved in .csv
form  rather than SDF form.

Removing a field in a program was even more work.  It entailed creating
a normal table (from a structure extended table) with the field to be
remove at the end of the record.  A normal append would place named
field in named field even if the field order differed.  One could then
export the data and create a new table with the new fields.

From the dot prompt modi stru  tablename would do the job.

Mervyn.


>
> Should do it. However, this is strictly from memory as I no longer have
> dBase IV installed and haven't had for over a decade....
>