Troubleshooting
Problem
Resolving The Problem
This document first describes a few scenarios that make you consider using the Apply Journaled Changes (APYJRNCHG) command, and then it discusses the best practices of the command. If you are not 100% positive your file is journaled, confirm with DSPFD and search on currently journaled. Find the scenario below that fits your needs.
Scenarios
| o | A user just made some changes to my file that I do not want. Can I recover with APYJRNCHG? I accidentally deleted several records from my file. Can I recover with APYJRNCHG? For the above two situations, you might be able to recover with the Remove Journaled Changes (RMVJRNCHG) command. Consider the following questions: o Are you journaling Before and After images? You can determine this with DSPFD. If so, you might want to consider using RMVJRNCHG so you do not need to restore the file from backup. RMVJRNCHG is discussed in Rochester Support Center document, RMVJRNCHG fround at URL: http://www.ibm.com/support/docview.wss?uid=nas8N1019013 o If you are journaling only After images and you have a recent save, you can recover by using APYJRNCHG. Restore the file, and use APYJRNCHG up until the point the bad changes were made. Refer to the section APYJRNCHG by Sequence Number below. |
| o | My file encountered damage today. I do have a recent save. Can I recover with APYJRNCHG? Yes. You must delete the damaged file, restore from the recent save, then use APYJRNCHG. |
| o | I accidentally deleted my file. I do have a recent save. Can I create a new file and use APYJRNCHG? Yes. However, do not create a new version of the file. The system sees the old and new versions of the file as two separate things. A new version of the file will have a new JID (Journal ID), and the journal will not apply old changes to the new file. If you have already created a new version of the file when attempting to recover, delete it or at least move it. Now restore the old version of the file and use that in APYJRNCHG. Remember to stop applying journal entries before the delete entry, otherwise APYJRNCHG will delete your file for you. Refer to the section APYJRNCHG by Sequence Number below. Note: D - DF is the entry for Delete File. |
| o | I have multiple files to recover. Can APYJRNCHG *ALL be used? Yes. However, there is no generic option. It must be 1 file or *all files. |
APYJRNCHG - The Command
The defaults on the command imply that within this history of entries, the file has not been Saved, Restored, Reorganized, or otherwise tampered with. You must take into account the history of your file during the time frame of the changes. If you run into an entry that cannot be applied, you may need to manually run a command and use multiple APYJRNCHG commands (specifying sequence numbers). For further information, refer to the Journal Management manual under the topic Actions of applying or removing journal changes by journal code.
The defaults also imply that you have just restored the file from its most recent save. If you use the wrong saved version, you will get a CPF7050 - LASTSAVE date not same as restored version. For example, you do a nightly save at 10 P.M.; however, Joeuser decides to save PRODFILE to a SAVF at 3 A.M. If you restore PRODFILE from the 10 P.M. save and use FROMENTLRG(*LASTSAVE), the entries from 10 P.M. - 3 A.M. will be missing.
The following are the defaults for the command. If they work for you, then you have an easy APYJRNCHG.
APYJRNCHG JRN(PRODLIB/QSQJRN) FILE((PRODLIB/TABLENAME)) RCVRNG(*LASTSAVE) +
FROMENTLRG(*LASTSAVE) TOENTLRG(*LASTRST)
Press the Enter key.
APYJRNCHG by Sequence Number
| Note: Customized assistance in locating the sequence numbers that are right for your unique environment requires a consulting agreement. Let your Support Representative know if you require this type of contract. |
This is the most accurate way to use APYJRNCHG. Do the following:
| 1. | Use the DSPJRN command to determine which sequence numbers you want to apply. The following is an example of the command: DSPJRN JRN(PRODLIB/QSQJRN) FILE((PRODLIB/PRODFILE)) JRNCDE((R) (D) (F))) This command will show you all Record, File, and Member level changes (R journal code = updates, inserts, and deletes) made to the file. Scroll through this DSPJRN output and look for entries you want to apply. After you find the first and last entries, write down both these sequence numbers. It can help to search on times. For example, if a user did an incorrect CPYF at 2:00, the time of the last sequence number you want to apply must be before 2:00. |
| 2. | Use those sequence numbers in the APYJRNCHG command. The following is an example of the command: APYJRNCHG JRN(PRODLIB/PRODJRN) FILE((PRODLIB/TABLENAME)) FROMENT(2000) TOENT(5000) |
Related Information
Historical Number
N1019016
Was this topic helpful?
Document Information
Modified date:
03 February 2026
UID
nas8N1019016