Multiple Log Files

The transaction management facility allows the program to use multiple log files. Different types of transactions can be logged in separate log files, giving you quicker access to a particular type of transaction. Each log file records the information that is necessary to recover a particular file or set of files.

The application administrator or programmer can specify an individual log file to use with any given set of data files. The specified log file is updated whenever a transaction is committed in its associated data files. Log file names are specified with configuration variables of the format:

filename-LOG logfilename

where filename is the base name of the data file, and logfilename is the name of the log file. filename should not include any directory names, nor should it include a file extension. logfilename can include the absolute or relative directory path ending with the name of the log file. If the log file is not found, a new file is created there with the specified name. Note that logfilename can have remote name notation. A configuration file entry for multiple log files might look like:

#transaction temporary file directory
LOG-DIR /usr/transaction-tmp/
#log file definitions
file1-LOG file1.log
file2-LOG file2.log
file3-LOG file3.log
#default log file definition
LOG-FILE  default.log

In the example above, during a commit, all of file1's updates are written to file1.log, all of file2's updates are written to file2.log, and so forth. If other data files are updated during a transaction, their updates are written to default.log. Operations performed with the RENAME or C$COPY library routines are also written to default.log.

A default log file must be specified in the LOG-FILE variable. The runtime creates that log file, or opens the existing one, as part of the first START TRANSACTION statement. Log files specified with filename-LOG variables are created or opened when the file whose base name is filename is opened OUTPUT or I/O for the first time in the program. Note that this means that any error that can be returned from a START TRANSACTION can also be returned as a secondary code of an error 9E on an OPEN statement. See Transaction Error Handling for more information.

Multiple log files can be used only with Vision indexed files and relative files. Transaction management for other file systems is dependent on the specific file system's transaction management facility.