Example: Removing journaled changes
Even though the following examples show database physical files and data areas being processed separately, you can do them with one Remove Journaled Changes (RMVJRNCHG) command if you use the OBJ parameter for both object types.
By using the code examples, you agree to the terms of the Code license and disclaimer information.
Database physical file
The following command removes the changes in journal JRNA from the all the members of FILEA:
RMVJRNCHG JRN(JRNLIB/JRNA) FILE(DSTPRODLIB/FILEA) FROMENT(*LAST) TOENT(*FIRST) RCVRNG(*CURRENT)The *CURRENT journal receiver is the journal receiver that is attached to journal JRNA at the beginning of the operation. The system starts removing the changes beginning with the latest entry for that member in this receiver and continues to the earliest entry for that member in this receiver.
The following command removes the changes in journal JRNA from all the members of FILEA:
RMVJRNCHG JRN(JRNLIB/JRNA) FILE(DSTPRODLIB/FILEA) FROMENT(*LAST) TOENT(*FIRST) RCVRNG(JRNLIB/RCVA10 JRNLIB/RCVA8) OUTPUT(*OUTFILE) OUTFILE(MYFILE)The system starts removing the changes beginning with the last entry (the latest entry) for that member in journal receiver RCVA10 and continues to the first entry (the earliest entry) for that member on journal receiver RCVA8.
Because OUTPUT(*OUTFILE) is specified, an output file with the name MYFILE is created. The output file contains a record for each object that the remove operation processes. See Use the apply and remove journaled changes output file for an explanation of each field in the record.
Data area
The following removes the changes in JRNA from data area DATA1 from the last save entry to entry number 1003.
RMVJRNCHG JRN(JRNLIB/JRNA) OBJ((LIBA/DATA1 *DTAARA)) RCVRNG(*CURRENT) FROMENT(*LASTSAVE) TOENT(1003)If the last save operation used the save-while-active function, the system starts by removing changes from the entry preceding the last E EW start of save entry. If the last save operation was a normal save operation, the system starts by removing changes from the entry that precedes the last E ES data area saved entry. In the example, journaled changes are removed back to entry 1003.
Read the Code example disclaimer for important legal information.
Parent topic:
Recovery of journaled objectsRelated concepts
Use of the QAJRNCHG fileRelated reference
Remove Journaled Changes (RMVJRNCHG) command