Retrieve Deleted Records
When records are deleted from a System i database file, the data can no longer be accessed by programs. While the deleted records continue to occupy space in the file until they are removed using a function such as RGZPFM or CPYF with COMPRESS (*YES), the data itself is no longer available.
ProData utilities offer two methods to retrieve deleted records.
RDR utility
- Must be used on a physical file
- Will retrieve all deleted records in a file or deleted records within a RRN range
- The number of deleted records in the file is displayed
- Records retrieved will be placed in a second file designated on RDR command
- Records may be retrieved with RRN attached, for analysis purposes
- If DBU is owned, the deleted records retrieved will automatically be shown to the user using DBU
Two methods can then be used to retrieve the record(s).
1) The desired deleted records can be copied back into the original file. Use CPYF (with *DROP in Record format field mapping, if RRN's were requested) to copy the appropriate records back to the original file. In this case the retrieved records are placed at the end of the file.
2) Once the deleted records to be restored have been identified, use the RDR function within DBU to reactivate the record(s) in place, in the original file.
**Hint** Building logicals over the retrieved deleted records will help in locating the correct deleted records. The physical RRN is showed on the display of the logical file records.
DBU retrieval of deleted records
- Can only be used on physical files in arrival sequence
- Will retrieve one record at a time
- Retrieve deleted records is activated/deactivated by typing RDR in the control field on the file display within DBU
- Record is reactivated in place
- Records are found by rolling through the file or advancing through the file using the search function or by keying in a relative record number in the control field and hitting <Enter>. When a deleted record is found, the message ** DELETED RECORD ** appears. Pressing <F17> will display the deleted record, pressing <F17> again will reactivate the deleted record.