| Directives |
|
| Formats | 1.
Open
System Journal:
SYSTEM_JRNL OPEN journal$ 2. Close System Journal: SYSTEM_JRNL CLOSE 3. Enable Journalization: SYSTEM_JRNL ENABLE filename$ 4. Disable Journalization: SYSTEM_JRNL DISABLE filename$ 5. Add Entry to File: SYSTEM_JRNL WRITE var$ 6. EFF Begin Transaction: SYSTEM_JRNL BEGIN 7. Database Auto-Commit Control: SYSTEM_JRNL AUTO {ON | OFF} 8. Database Commit Transaction: SYSTEM_JRNL SAVE 9. Dynamic Auto-Commit: SYSTEM_JRNL BEGIN AUTO 10. Database Roll Back Transaction: SYSTEM_JRNL RESTORE 11. Dirty File Indicator: SYSTEM_JRNL DIRECTORY directory$ 12. Swap journal files: SYSTEM_JRNL SWAP
|
|||||||||||||||||||
| Description | Use SYSTEM_JRNL to have ProvideX log all updates to specified data files. | |||||||||||||||||||
| Journal sequencing | Journal
files are limited to a size of 2GB. It is important to
make sure that a journal file is closed and a new journal
is started before exceeding this limit. In order to avoid this problem, PxPlus provides for the automatic rollover to new journal files whenever a journal file exceeds 2,000,000,000 bytes in size. This option is enabled by specifying a directory name as the journal$ field when opening a system journal. If a directory is specified the system will automatically will create sub-ordinate files within the directory called journal.1, journal.2, ... As each file fills up the system will automatically create and start logging to the next highest file.
|
|||||||||||||||||||
| See Also | SERIAL Create a Sequential File. | |||||||||||||||||||
| Format 1 | Open System Journal
This format opens the journal (serial file); e.g.,
Journal Contents The physical journal file is a binary file that has a special format designed for quick write access and efficient retrieval. Each of the journal file's records has a 16-byte header consisting of:
The rest of the record is the before/after image of the data. The file itself has a four-byte header with the address of the last record on the file. |
|||||||||||||||||||
| Format 2 | Close System Journal This format closes the open system journal. |
|||||||||||||||||||
| Format 3 | Enable Journalization
Use this format to enable journalization for the specified data file (Keyed or Indexed files only). Enabling journalization sets a bit in the file header for the specified file Specifying a file name of * initiates the journalization of all keyed/indexed file updates.. |
|||||||||||||||||||
| *Note* | If you have enabled journalization for a data file, you cannot access that file unless the journal file is open. | |||||||||||||||||||
| Format 4 | Disable Journalization
Use this format to disable journalization for the specified data file. |
|||||||||||||||||||
| Format 5 | Add Entry to File
This format adds the contents of var$ to the currently open journal (serial file). |
|||||||||||||||||||
| Format 6 | EFF Begin Transaction This directive is used to mark the start of a transaction. All updates to file systems (EFF, ODB, DB2, Oracle, and MYSQL) will be deferred until the transaction completes and it is committed using the SYSTEM_JRNL SAVE directive. |
|||||||||||||||||||
| Format 7 | ODBC/OCI Auto-Commit
Control
This format is used to control auto-commit mode of an EFF, ODBC, DB2, Oracle or MySql database connection. Auto-commit means that all updates to the database are made immediately and cannot be rolled back in case of an error. SYSTEM_JRNL AUTO OFF will disable the auto-commit mode of operation. All updates to the database are deferred until the application successfully ends or a SYSTEM_JRNL SAVE directive is issued. SYSTEM_JRNL AUTO ON re-enables Auto-commit mode. |
|||||||||||||||||||
| Format 8 | ODBC/OCI/EFF Commit
Transaction This format will commit all pending/deferred updates to a database transaction, if auto-commit mode is disabled; Error #15 is reported, if a database error occurs. |
|||||||||||||||||||
| Format 9 | Dynamic
Transaction Auto-commit
PxPlus provides enhanced auto-commit logic that automatically uses transaction processing logic to defer all updates to a database until the application enters an idle state such as waiting for input or issuance of a WAIT directive. This Dynamic Auto-commit improves both system performance and the reliability of updates since all changes to the database occur at the same time. This helps assure synchronization of all updates between files and/or databases. |
|||||||||||||||||||
| *Note* | Due to the nature of the commitment process on different databases servers, the system cannot assure that updates done on different databases occur in unison. It is possible, although unlikely, that during a commit cycle, updates may be committed to one database and an error occur during the commit to another database thereby rendering a potential inconsistency between the databases. | |||||||||||||||||||
To
disable the Dynamic Auto-commit, re-enable Auto-commit by
issuing SYSTEM_JRNL AUTO ON.
|
||||||||||||||||||||
| Format 10 | ODBC/OCI/EFF Roll Back
Transaction This format will roll back and discard all pending/deferred updates within database transaction, if auto-commit mode is disabled; Error #15 is reported, if a database error occurs. |
|||||||||||||||||||
| Format 11 | Dirty
File Indicator
This format is used to track potential file corruption (dirty files) by maintaining a list of all the files that have been opened and modified during a ProvideX session. ProvideX creates a single tracking file per active process in directory$. When a session terminates normally, it deletes its tracking file; therefore, the existence of a tracking file means there is either a ProvideX task currently active, or that a ProvideX task has terminated abnormally (due to software fault or operating system failure). Specifying a null directory name will disable this feature. If the directory name specified does not already exist, an Error #12: File does not exist (or already exists) will be generated. An Error #13: File access mode invalid is reported, if a file of the same name exists, but not as a directory. Tracking Files Each tracking file (log) is created with a unique name using the following format:
Where:
The tracking file contains a list of all the data files that have been physically updated and not yet closed by the ProvideX process. Every time a file has an update issued against it, the system will add the pathname to the tracking file. Each line will be separated by a standard (OS dependant) end-of-line sequence. Multiple occurrences of the same file may exist in the tracking file, as entries are maintained based on open channels. The tracking file is updated to indicate when a file is being updated prior to the execution of the WRITE or REMOVE directives. When a file that was logged is closed, its entry from the log file will be removed. To help ensure that the contents of the tracking file are accurate, ProvideX will close the file after each write. |
|||||||||||||||||||
| *Note* | Only Keyed files (EFF, VLR and FLR) and Indexed files are tracked. | |||||||||||||||||||
| Format 12 | Swap
journal files
This directive can be used in conjunction with the auto-sequencing of log files which is a +PxPlus Exclusive (version 9) When issued the current journal file is marked full and a new journal file is started. |
|||||||||||||||||||
| Examples | The
following code sample illustrates parsing of a
SYSTEM_JRNL file:
|
|||||||||||||||||||
The
following illustrates use of the SYSTEM_JRNL for tracking
potential file corruption (dirty file indicator):
|
||||||||||||||||||||