To lock a file

When you write the data for a transaction, the audit server can close the current sequence and start using the next sequence. As a result, the audit server can change the current sequence field in the information file header. The audit server also changes the sequence status and sequence end time for the current sequence, and changes the status and start date/time of the next sequence.

Even if the audit server does not switch sequences, the server must change the current offset in the information header and the number of transactions in the sequence header. For this reason, the audit server always changes the information header and the sequence header. In addition, because the sequence header is maintained in the sequence file and information file, both of these must be changed.

At the start of a transaction termination command for each table, and before writing buffered data to the audit file, the audit server locks the information file header and sequence header in the information file and in the sequence file. The audit server puts write locks on, so that no other read or write lock can succeed. After the data for all tables is written, the locks on all tables are released. If an error occurs on any table, the status of transactions for tables already written is changed to Abort and the locks on all tables are released.