Automatically starting journaling

 

Using a data area named QDFTJRN, you can automatically start journaling when a non-integrated file system object (data area, data queue, or file) is created, moved, or restored into the library, thus, ensuring the very first change to the object will be recorded in the journal and that no lock on the user's part prevents journaling from starting in the library. The QDFTJRN data area must exist in the library where the object is being added.

  • The QDFTJRN data area must be created by the user.

  • To automatically start journaling for integrated file system objects, see the discussion of journal inheritance in Journal integrated file system objects.

If a data area called QDFTJRN exists 1) in the same library into which the data area, data queue, or physical file is created, or 2) in the same schema that the SQL table is created into, and 3) the user (in either instance) is authorized to the data area, journaling will be started to the journal named in the data area if all the following are true:

  • The identified library for the data area, data queue, or physical file or identified schema for the SQL table must not be QSYS, QSYS2, QRECOVERY, QSPL, QRCL, QRPLOBJ, QGPL, QTEMP, or any of the independent auxiliary storage pool (IASP) equivalents to these libraries. (An iASP equivalent of QRPLOBJ, for example, is QRPLxxxxx where 'xxxxx' is the number of a primary auxiliary storage pool (ASP).)

  • The journal specified in the data area must exist and the user must be authorized to start journaling to the journal.

See the table below for a detailed description of the values within the data area.

When creating SQL tables within a schema, the QSQJRN journal within the schema is used to start journaling the tables. To start journaling the tables to a different journal than QSQJRN within the schema, create the QDFTJRN data area in the schema and specify a different journal name inside the QDFTJRN data area.

This table shows formats of the QDFTJRN data area.

Offset Field Format Description
1 Library name Char (10) Name of the library that contains the journal.
11 Journal name Char (10) Name of the journal to use to automatically start journaling.
21 Repeat the set of Object type and Option as needed:
Object type Char (10)

Object type value:

  • *FILE = database files or SQL tables

  • *DTAARA = data areas

  • *DTAQ = data queues

  • *ALL = all journal eligible objects which are not in an integrated file system

  • *NONE = no objects
Option Char (10)

Option:

  • *CREATE = Start journaling when an object is created into the library

  • *MOVE = Start journaling when an object is moved into the library

  • *RESTORE = Start journaling when an object is restored into the library

  • *ALLOPR = Start journaling in all cases possible

  • *RSTOVRJRN = Override the saved object's journal and start journaling to the journal name in this QDFTJRN data area when the object is restored into the library

The values in the data area must be in upper case.

 

Restore impact

The QDFTJRN data area provides more options for journaling during the restore operation. When using the *RESTORE keyword in the QDFTJRN data area, even if an object was not journaled at save time, the operating system automatically records the restore operation to the journal specified in the QDFTJRN data area. However, if the object was journaled at save time and that journal still exists on the system, the journal specified in the QDFTJRN data area is ignored. In this case, the operating system still records the restore operation to the journal used at save time.

You can use the *RSTOVRJRN keyword to override the journal used at save time. After you specify the *RSTOVRJRN keyword in the QDFTJRN data area, the operating system always records the restore operation to the journal that is specified in the QDFTJRN data area. In this case, any journal used at save time is ignored. PTFs SI24505, SI24794, SI24812, and SI24864 are required to activate this *RSTOVRJRN keyword function.

If the object being restored still exists on the system, the *RSTOVRJRN keyword is ignored during the restore operation. When the *RSTOVRJRN keyword is in effect, if the journal named in the QDFTJRN data area does not exist on the system, the restored object will not be journaled.

If you changed the journal of your object using the *RSTOVRJRN keyword, save your object as soon as possible to enable future recovery operations with the Apply Journaled Changes (APYJRNCHG), Apply Journaled Changes Extend (APYJRNCHGX), and Remove Journaled Changes (RMVJRNCHG) commands. The save operation records the journal receiver and the new journal as the journal receiver and journal to use for recovering your object from the point of its last save. The save operation also updates the last saved date of your object, if UPDHST(*YES) is specified on the save command.

To use the *RSTOVRJRN keyword to override the journal used at save time, position the *RSTOVRJRN keyword in the QDFTJRN data area before the references to the *ALLOPR or *RESTORE operation option. Here is an example.

For example, the files restored into library OVERRIDE are currently journaled to journal SAVEJRN in library SAVELIB. But you want the files to be journaled to journal OVERJRN in library JRNLIB, while you still want the restored data areas or data queues to be journaled to the save time journal. And you also want any new objects created into the library OVERRIDE to be journaled to journal OVERJRN in library JRNLIB. To achieve this, use the following commands to create the QDFTJRN data area.

CRTDTAARA DTAARA(OVERRIDE/QDFTJRN) TYPE(*CHAR) LEN(80)                       
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (1 10) VALUE(JRNLIB)                      
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (11 10) VALUE(OVERJRN)                    
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (21 10) VALUE(*FILE)                      
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (31 10) VALUE(*RSTOVRJRN)                 
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (41 10) VALUE(*ALL)                       
CHGDTAARA DTAARA(OVERRIDE/QDFTJRN) (51 10) VALUE(*ALLOPR)   

The library and journal names in columns 1-20 must be in upper case.

 

Parent topic:

Starting journaling