If an object becomes damaged or is not usable you can recover the object using the Apply Journaled Changes (APYJRNCHG) or Apply Journaled Changes Extend (APYJRNCHGX) command. If you restore an object that was saved with partial transactions, then you must apply journaled changes to that object before it is usable.
There are slight differences between the Apply Journaled Changes (APYJRNCHG) command and the Apply Journaled Changes Extend (APYJRNCHGX) command. The APYJRNCHGX command only applies entries for database files and requires entries to be applied for all files in a library. This command will also apply entries for logical files found in the library, and it will apply the create file (D CT) journal entry. The APYJRNCHG command will not apply entries for logical files, or the create file entry. The APYJRNCHG command also applies entries for non-database objects.
You can apply journaled changes to all objects that are journaled to the journal by specifying OBJ(*ALLJRNOBJ) on the APYJRNCHG command.
You can ensure that commitment transaction boundaries are honored during the apply journaled changes operations by using the commit boundary (CMTBDY) parameter. The default value for the CMTBDY parameter is *YES. If the system encounters a journal entry that causes the apply or remove process to stop for the object, the commitment boundary might not be honored.
When the system encounters a journal entry it cannot process, it ends apply processing either for that specific object or for the entire apply operation. You can specify how the system behaves when it encounters a journal entry it cannot process with the Object Error Option (OBJERROPT) parameter on the APYJRNCHG or APYJRNCHGX command. If you specify OBJERROPT(*CONTINUE), the system ends apply processing for the specific object that has an error, but it continues apply processing for the other objects in the apply operation. If you specify OBJERROPT(*END), the system ends processing for the entire apply operation. The OBJERROPT parameter is also available for the Remove Journaled Changes (RMVJRNCHG) command. Actions of applying or removing journaled changes by journal code shows which entry types cause processing to end for an object.
You must first reestablish the object to a condition that you know is undamaged.
You must restore the needed journal receivers if any of the following are true:
When you apply journaled changes to an object, the object cannot be in use by anyone else.
When the condition of the object has been established, use the APYJRNCHG or APYJRNCHGX command to apply the changes that are recorded in the journal to the object.
The system applies the changes to the object in the same order as they were originally made. You must plan where you want to start and stop applying changes. Use the Display Journal (DSPJRN) command to identify the desired starting and ending points. If you use a control language (CL) program for your recovery procedures, use the following:
You can also use the QjoRetrieveJournalEntries API to retrieve the information into a High Level Language (HLL) program.
On the APYJRNCHG or APYJRNCHGX command, specify the first journal entry to be applied to the object. This entry can be selected from any of the following points:
You can stop applying the journal entries at the following:
It is highly recommended that you use the apply and remove journaled changes output file when you apply journaled changes. The output file contains a record for each object that the apply operation processes. It contains a record for each object created and each object deleted during the apply. This output file is especially useful when the apply ends early. It is much easier to query the output file for the status of each object rather then searching through the job log messages. Also the messages are limited to 512 while the output file is not limited.
Considerations for applying changes are as follows: