[ Programmer's Guide ]

Database Organization #

Introduction #

This section adds implementation detail to the section File Organization in the Overview.

Each Max2 database resides in its own directory. There is no reason not to put other files in the directory but no advantage to doing so either.

Extensions #

The following file name extensions are used in a Max2 database:

.LOK #

There is one "lock" file called MAX2.LOK. This contains much of the static (month independent) information for the database such as the number of the most recently closed month, the list of operators and the layout of statements.

.INI #

These files follow the standard Windows variant of the INI file format.

There may be one file in the database directory called Max2DB.ini. If it exists, this contains details of whether the database is a mirror, and, if so, which database it is a mirror of and also details of the external processes called for account processing (e.g., e-mailing statements).

There can also be a Max2.INI file in the main Windows directory (typically C:\Windows). This is shared by all databases on the machine and only stores the user selected positions of Max windows which have been opened. If it is lost the user will just have to position the windows again.

The Max2.INI file in the main Windows directory also contains a copy of the external process configuration information and this will be used in preference to that in the database directory. However, it too can safely be lost as long as the copy in the database Max2DB.ini file has been preserved.

.SOM #

There is one start-of-month transaction file for each month. It contains transactions which apply across the whole month, not just to a particular day, such as account creations and changes to the charging rules.

.DLY #

There is one daily transaction file for each month. It contains transactions which apply to a particular day in the month, such as glider flights, cash received transactions and so on.

.SDL #

The sorted daily transaction file is a temporary file created as part of the process of sorting the daily transaction file (as part of a state file rebuild). Normally it is created, the original unsorted transaction file is deleted then the sorted transaction file is renamed to replace the original. There is code in MAIN.FRM to deal with the situation where there has been a failure between the time of creation of the sorted file and the completion of the final rename operation.

.PSM #

The processed start-of-month transaction file is a temporary file created when processing the start-of-month file, e.g., when anonymizing old account records for data protection purposes.

Normally it is created, the original start-of-month file is deleted then the processed transaction file is renamed to replace the original. There is code in MAIN.FRM to deal with the situation where there has been a failure between the time of creation of the processed SOM file and the completion of the final rename operation.

.STT #

There is one state file for each month. It contains a snapshot of the effect of application of each of the transactions so far entered for the month (and all preceding months).

Month File Names #

The .SOM, .DLY, .SDL.PSM and .STT files are specific to an individual month. Their names consist of the four digit year, a hyphen and the two digit month number (starting with "01" for January). E.g., the state file for February 2005 is 2005-02.STT.

Backup #

It is not necessary to backup all of the files in a Max2 database directory to ensure that all of the data is safe. In particular, the state files (.STT) need not be backed up as they can be re-created from the transaction files. Not backing them up saves a significant amount of space.

In normal operation there shouldn't be any .SDL or .PSM files so a routine backup need not save them. However, if there are such files present it indicates that Max should be run and the relevant month selected to sort the problem out. In the case of an emergency backup on a machine which is failing or the recovery of data from the disk of a machine which has failed protection of any .SDL or .PSM files would be sensible as they possibly might contain the only copy of some of the transactions for the relevant month.

The MAX2.INI file in the Windows directory could be backed up if required but it's probably not worth any hassle as the windows can be repositioned to the operators' preferences easily enough.

See also the System Administration sections: Database Backup and Database Restoration.