Housekeeping is an important part of a system or data. With housekeeping, we expected to maintain system stability and reliability.
The housekeeping method that will be discussed first is to clear files or to clear the entire contents of the record. For this section, if we have several files that can be done by deleting all the data in the file, then the following methods can be used:
Using SQL statement
DELETE FROM LIBA/FILEA
Using Command CLRPFM
If the file is large enough, it is advisable to submit a job with SBMJOB. This command will be executed if there is no locking in the file.
Using Swap Empty File
Prepare a blank file using the CRTDUPOBJ command to another library / temporary library. In the example below, duplicate FILEA from LIBA to LIBB.
Ensure the following conditions:
- If the file does not contain multiple logical files, duplicate the logical files to a temporary library. To check the logical file in the file, use the DSPDBR command
- If files in the source library are journaled, the files in the temporary libraries are journalized using the STRJRNPF command
Swap files using the MOVOBJ command, with steps, Move File FILE along with logical files (if any) in LIBA to LIBC (second temporary library), then move FILEA along with logical files (if any) in LIBB to LIBA (empty files are moved to source library).
Of the three methods above in the clear file, I prefer to use the swap object method. But it also depends on how long your application downtime can be accepted. Doing a study first is highly recommended.