Tabmods

 

 

 

TABMODS is the name given to the process of applying needed changes to database tables, usually in conjunction with software changes.

 

Each time H2OS is started, it runs the TABMODS program which will insure all required database table changes have been implemented.

 

The typical use of TABMODS is when a new field is added to a screen. Behind the screens, the data for this field is stored in a database table, but the table has to be structured to contain the new field before it can be stored and re-used. Adding new fields is a procedure performed by the TABMODS program at this time.

 

There are 2 ways to run TABMODS

 

1. During startup,TABMODS is automatically run. But it will only check mods that have not yet been run (according to the maintenance log).

 

2. Older, archived changes, can be re-run at any time by selecting HELP->MAINTENANCE LOG->CLEAR MAINTENANCE LOG and restarting H2OS. This will cause TABMODS to run during startup. It will check for, and where necessary make database table changes. There can be cases, for example restoring a backup, where old TABMODS will need to be re-run. This utility is for this purpose. In all cases, TABMODS will always check to see if the change to be made has already been made, and skip attempting to make such changes again.

 

 

To start the Maintlog program, Select help->maintenance log

 

 

 

The MAINTLOG screen will appear.

 

To re-run all registered TABMODS on this screen, click the CLEAR MAINTENANCE LOG command

 

 

 

Reply YES

 

 

 

 

 

Restart H2OS

 

 

After restarting, navigate help->maintenance log to view the list of MOD changes applied during startup.

 

To be sure, this list indicates that the named change has been made. TABMODS may or may not have actually made the change at this time because the change could have already been made, so this entry is just confirming it.

 

 

 

 

 

 

To re-run TABMODS

 

To re-run a single TABMODS, go to Help -> Maintenance Log and find the TABMOD to be re-run in the FIX# column, and overtype the name in some way to change it. H2OS will re-run that particular mod the next time it is started.

 

To re-run ALL TABMODS, go to Help -> Maintemance Log, then click the CLEAR MAINT LOG button and restart H2OS.  TABMODS changes will be applied, if not already made, during the next H2OS startup.

 

Also see the H2OS Recovery Console, which has an option to run TABMODS directly, without requiring H2OS to be running.

 

 

About TABMODS and MAINTLOG.DBF

 

If you restore or switch to an H2OS database that was created before one or more TABMODS changes, then changes previously applied to the old database will not be applied to the now current database, so an action must be taken for this to happen.  

 

This is accomplished by hiding (renaming) the file named MAINTLOG.DBF.  This action can be performed using the H2OS Recovery Console or by the method to re-run TABMODS, above

 

How this works:

 

Ongoing changes to H2OS database tables are made by a program called TABMODS which is run every time H2OS is started.

 

Each change is performed by one procedure in TABMODS, named MOD001, MOD002, etc. There is one MODnnn procedure per change

 

TABMODS is called during each H2OS startup. It, in turn will call each change procedure, and each procedure applies it's change. If the change has already been made, it skips the attempt. When TABMODS completes, the current database is in sync with changes made to it over time.

 

For record keeping and efficiency, TABMODS creates a record in the MAINTLOG table for each changes it makes. These records are used by TABMODS during startup to skip change procedures if they've already been run.   Each change procedure, when launched, goes about it's business of accessing the table to be changed to determine if a change is actually needed. Since connecting a table to inspect it takes time, if there are many tabmods changes, running them all every time H2OS is started can delay startup more and more over time. By using MAINTLOG, no time is wasted during startup looking to make changes that have already been made.

 

This works all well and good until the operator switches (or restores) the current database to a backup or another database, and that database is not up to date per TABMODS (i.e. the database is out of sync with the current level of software)..

 

This is a problem because TABMODS will check MAINTLOG.DBF to see if  changes have been made, and if they have been made (to the old database) then will think they have been made to the current database and therefore skip the call to the named change procedure which will check to see if the change was made

 

By renaming MAINTLOG.DBF, TABMODS will not be able to find any MOD records and will attempt to make all registered changes (that is,  call all of the currently existing TABMODS embedded change procedures). TABMODS will build a new MAINTLOG.DBF showing the changes have been made (or found to have been made) to the now current database.

 

Note that each procedure (change) called by TABMODS will check to see if the change it will make has already been made, and not attempt to make it again.  

 

(so, you can see that MAINTLOG.DBF is first checked to see if the change procedure has been run or not. We've hidden MAINTLOG.DBF, so each will be called. Then, once called, each will check to see if the change has already been made, so there are 2 levels of processing before TABMODS actually attempts to make a change).

 

MAINTLOG can be cleared and TABMODS run repeatedly without harming the database