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.
AS400 table is a *FILE object, the CPYF command is used to copy all or part of the table structure in the database to another table. The following is the copy file command that I usually use:
Member Option > MBROPT
# MBROPT(*ADD) - Copy all record source files to the target file
# MBROPT(*REPLACE) - Copy all the record source files to the target file starting with delete member files first
Create File > CRTFILE
# CRTFILE(*YES) - Create a new file in the target library
# CRTFILE(*NO) - If file is already available in the target library
Copy From – To Record Number > FROMRCD – TORCD
# FROMRCD (*START/<rrn>) - *START if you want to copy the first record from the source file, or <rrn> relative record number if you want from a specific record number
# TORCD (*END/<rrn>) - *END if you want to copy until the last record from the source file, or <rrn> relative record number if you want to reach a certain record number
Record Format Field Mapping – FMTOPT
This parameter is used if the source file format is different from the target file format
# FMTOPT (*NOCHK) - Copy files based on the length of the existing records
# FMTOPT (*MAP *DROP) - Copy files based on existing field names (*MAP) and ignore non-existent fields (*DROP)
Disaster Recovery always been associated with Recovery Point Objects and Recovery Time Objects (RPO and RTO).
Recovery Point Object (RPO) is the last point in time that an IT system can be recovered. In this section, the technology used determines how far behind the data or even the loss of a company when there is a disruption to the main system. RPO is used in technologies such as backup, storage replication, data replication and others.
Recovery Time Object (RTO) is related to the time it takes for an IT system to operate normally again when a planned / unplanned interruption occurs. For unplanned interruptions, error detection, data recovery and bringing the application back online are included in RTO.