Product: | DBConnectivity Products for IBM Db2 for i (HiT ODBC/400, HiT OLEDB/400, Ritmo/i, HiT JDBC/400) |
Version: | All |
ID: | 1056 |
Summary: | How to create a receiver and a journal, and how to stop/start a journal |
Journalizing with New Libraries
When you create a new library: define it as a COLLECTION, using an SQL statement from the AS/400 console (use STRSQL utility) or using the HiT Driver from the PC:
CREATE COLLECTION MYLIB
The system automatically creates a journal and journalizes all the objects created in the collection. All the tables can be included in a transaction.
Journalizing with Existing Tables and Libraries
To verify that a table is journalized, use this command from the AS/400 console:
DSPFD LibName/TabName
Scroll the pages until you find this property:
File is currently journalized: |
Yes |
Current or last journal: |
QSQJRN |
Library: |
MYLIB |
Journal images: |
IMAGES *BOTH |
Journal entries to be omitted : |
OMTJRNE *OPNCLO |
This data refers to a table that is journalized (line1), the name of the Journal is QSQJRN, in the library MYLIB. The IMAGES parameter indicates that data is stored before and after the execution of a statement, the last property indicates that the open and close operations on the table are not journalized.
If the table is not journalized, you need to link the table to an existing journal or create a new journal and a new receiver.
How to Create a Receiver
Type this command on the AS/400 console:
CRTJRNRCV
These settings can be used as a typical configuration:
Create Journal Receiver (CRTJRNRCV)
Type choices, press Enter.
Journal receiver |
recei01 |
Name |
Library |
mylib |
Name,*CURLIB |
Auxiliary storage pool ID |
*LIBASP |
1-16, *LIBASP |
Journal receiver threshold |
10000 |
1-1919999, *NONE |
Text 'description' |
*BLANK |
|
How to Create a Journal
The journal is the service that will keep track of the changes and will store them in the receiver.
From the AS/400 console, type this command:
CRTJRN
These settings can be used as a typical configuration:
Create Journal (CRTJRN)
Type choices, press Enter.
Journal |
JOUR |
Name |
Library |
MYLIB |
Name, *CURLIB |
Journal receiver |
RECEI01 |
Name |
Library |
MYLIB |
Name, *LIBL, *CURLIB, *LIBL |
Auxiliary storage pool ID |
*LIBASP |
1-16, *LIBASP |
Journal message queue |
QSYSOPR |
Name |
Library |
*LIBL |
Name, *LIBL, *CURLIB |
Manage receivers |
*system |
*USER, *SYSTEM |
Delete receivers |
*yes |
*NO, *YES |
Receiver size options |
*NONE |
*NONE, *RMVINTENT, *MINFIXLEN |
Text 'description' |
*BLANK |
|
Note that the ‘Manage receivers’ option is set to *system, because the receiver will be managed automatically by the AS/400. When a receiver is full, the system will create and use a new one. The ‘Delete receivers’ option is set to yes: the old receiver will be deleted automatically. This option will economize on space.
How to Start a Journal
After creating a journal, the table must be linked with the journal.
Use this command from the AS/400 console:
STRJRNPF
This is a typical configuration:
Start Journal Physical File (STRJRNPF)
Type choices, press Enter.
Physical file to be Journalized |
mytable |
Name |
Library |
mylib |
Name, *LIBL, *CURLIB + for more values |
Journal |
jour |
Name |
Library |
mylib |
Name, *LIBL, *CURLIB |
Record images |
*both |
*AFTER, *BOTH |
Journal entries to be omitted |
*opnclo |
*NONE, *OPNCLO |
The table mytable in the library mylib is journalized by the journal stored in the library mylib. The journal keeps an image before and after any change (Record Image option) and the open/close operations are excluded from the journaling (‘Journal entries to be omitted’ option).
How to Stop a Journal
Type this command from the AS/400 console
ENDJRNPF
End Journaling PF Changes (ENDJRNPF)
Type choices, press Enter.
Journalized physical file |
mytable |
Name, *ALL |
Library |
mylib |
Name, *LIBL, *CURLIB + for more values |
Journal |
jour |
Name, *FILE |
Library |
mylib |
Name, *LIBL, *CURLIB |
You only need to input the table name, the library, the journal name and the journal library (use the command DSPFD as explained before).
Other Related Commands
DSPJRN
DSPJRNRCVA
CHGJRN
WRKJRNA
GO CMDJRN