4.3 Modifying an RMSfile

The steps to modify the structure of an RMSfile are as follows:

1. Create or modify an RMS definition file that describes the new structure

1. Create a new RMSfile from the RMS definition file in step 1

1. Copy and reorganize the data from the original RMSfile to the new RMSfile

1. Remove the original RMSfile

1. Rename the new RMSfile

There are several C/Base programs that perform most or all of these steps as one operation, we will discuss convertlf (C-1) and lfedit (C-1).

Convertlf performs steps 2 through 5; you specify the RMS definition file for convertlf. Lfedit performs all the steps shown above. It invokes filedef to modify the RMS definition file, and invokes convertlf to perform steps 2 through 5.

Each record in the old RMSfile is copied to the new RMSfile a field at a time, by field name. There are three cases for copying fields as shown below:

1. The field exists in both the old RMSfile and the new RMSfile (you have not changed the field name). The field is copied (and converted, if the data types differ) from the old RMSfile to the new RMSfile.

1. The field exists in the old RMSfile but not in the new RMSfile (you have deleted the field, or have changed the field name). The field is skipped; it is not copied to the new RMSfile.

1. The field does not exist in the old RMSfile, but does exist in the new RMSfile (you have added a new field, or have changed the field name). The field in the new RMSfile is given a binary zero value.

WARNING: Changing the name of a field DESTROYS the data contained in the field. Lfedit and convertlf a changed field name as removing the old name and adding the new name which does not preserve the data in the field.

Convertlf makes the temporary copy of the RMSfile in the same directory as the original RMSfile.