You can change the structure of a database on a live system without affecting the data on the database. However, if you modify the key field of a table that contains data, DP4 prompts you to reorganise the database.
Other typical structural changes are:
Add a new field
Modify the data type of a field
Modify the size of a character field or the precision of a number field
If you make any structural changes such as these, DP4 increments the generation number of the database. DP4 checks this number before reading or writing a record. Each record on the database, and each application program, also has a generation number.
For Report Writer programs and programs written in third generation languages such as C, DP4 invokes data independence to ensure that records can be accessed and updated correctly, even if the program has a different generation number. QA Build programs need to be recompiled to give them the same generation number as your database.
DP4 implements data independence by recording the mappings of earlier structures as well as the data dictionary information for the current structure. Each time a program reads or writes a record to the database, the generation number is checked. If the generation numbers are different, the database manager translates the record into the current structure.
You should check whether changes to the database structure will affect the logic of your program. For example, the customer name field is changed from 6 characters to 5, and a program name contains a statement like this one:
REPEAT <some actions> UNTIL CUSTOMER NAME = 'ABCDEF'
With this syntax, all customer names would be presented to the program with blank as the last character, so the test can never succeed.
The data independence facility ensures that provided the logic of your program is not affected, you can change the database structure without changing your application programs.