Reorganizing the Database
Whenever you make changes to the database structure of your application, a reorganization of the runtime database is required. Database reorganization is always needed after any of the following changes:
- Adding a new database object (either a table, index or foreign key)
- Modifying a database object
- Installing/upgrading a new version of AMT-COBOL
When adding/modifying a database object, the following steps need to be performed:
- Check-in the database object. All other objects that use this specific database object will then automatically be set to status "Changed". This status can be seen on the Generate screen, along with a checkmark next to the object's name indicating that it has been marked for generation.
- Make sure that the application services and report services of the runtime application have been shut down. It is not necessary to close the reorganization service.
- Generate the objects. This can be done in several ways:
- By clicking on the actual database object's name in Revision Control or Repository Tree view, then clicking the green arrow in the top toolbar - "Generate this object(s)". The "Objects to Generate" window appears that displays all the objects that make use of the selected database object. Click "OK Generate".
- By going to the Generate screen and clicking the "Generate" button at the bottom of the screen. All objects that have a checkmark next to their name will be generated. NOTE: this will generate all objects with a checkmark, even those that may have been set by developers on other objects.
- After the generation process has ended, a new "App_Defs.dll" file will be created, containing the new database definitions.
- Deploy the generated application. The "AMT-COBOL Production Installer" is used for deploying the generated application from its source directory to its production directory(s). See also the steps that are described on the page "Installing or updating your applications" in the "AMT-COBOL Administration manual".
- Start the reorganize in the ControlCenter. See also the steps that are described on the page "Updating/reorganizing the application" in the "AMT-COBOL Administration manual".
If the property "NullValues" for a table field is set to "False" (done via the Object Inspector), after previously having a value of "True", the reorganization process will check whether there are NULL records for this field. If there are NULL records, these will be updated to an empty string of alpha fields or, in case it is a numeric field, to "0". Also the attribute "NOT NULL" will be set in the database. This way, the database management software guarantees the NOT NULL condition, should applications outside of AMT-COBOL add or modify records on the table. |
When a Boolean table field is added the Reorganization will leave the value of the field empty (space) regardless of the initial value set in the definition. When reading back a space is treated as Null. The new field must be set to either 'T' or 'F' before it can be used, especially if the new field is to be used as Key in an Index. Note: When using a report to set the undefined Boolean fields to false, you have to set them to true first, update the record and then to false and update again. |
When installing/upgrading a new version of AMT-COBOL, the following steps need to be performed:
If it is the first time that AMT-COBOL is installed, or if AMT-COBOL has been upgraded through a new patch or major release, you will have to do a full generation of every AMT-COBOL application. This is needed to make sure that all internal AMT-COBOL system tables are created according to the most recent AMT-COBOL version.
- Make sure that the application services and report services of the runtime application have been shut down. It is not necessary to close the reorganization service
- Generate the application by going to the Generate screen and clicking the "Whole System" button at the bottom of the screen.
- Deploy the generated application. The "AMT-COBOL Production Installer" is used for deploying the generated application from its source directory to its production directory(s). See also the steps that are described on the page "Installing or updating your applications" in the "AMT-COBOL Administration manual".
- Start the reorganize in the ControlCenter. See also the steps that are described on the page "Updating/reorganizing the application" in the "AMT-COBOL Administration manual".