Using KSAM/XL and KSAM 64 (32650-90886)

62 Chapter7
Protecting the File and Its Data
Backing Up KSAM Files
Backing Up KSAM Files
A regularly scheduled backup of all files is always advisable. The STORE/RESTORE
facility used for most other files is also appropriate for backing up KSAM files to tape. The
following commands provide a backup routine for a KSAM file.
FILE T=ARBACK;DEV=TAPE
STORE ARMSTR.MGR.AR;*T
NOTE
Do not use the TRANSPORT option of the STORE command with KSAM files.
The TRANSPORT option is intended as a migration option for storing files from
MPE/iX to MPE V/E systems.
Use the following commands to restore the file from tape:
FILE T=ARBACK;DEV=TAPE
RESTORE *T;ARMSTR.MGR.AR;KEEP;DEV=DISC;SHOW
The FCOPY utility can also be used to back up KSAM files on disk instead of tape. This
allows a quick recovery with little delay. If sufficient resources are available, this is an
effective and rapid method of backing up files.
Recovering from Index Corruption
If the file management subsystem detects file corruption, it does not allow writing,
updating, and deletion activities. The file manager attempts to honor read requests, but
the attempt may not be successful.
If index entries have been corrupted, create a new KSAM file using the BUILD command.
When the file is built, load the data from the original file using the FCOPY utility with the
KEY=0 option. The KEY=0 option does not access the indexes in the source file. It merely
transfers data records from source to target, creating new index entries after each record is
copied.
The following routine creates a new file and loads it with the data records from the original
accounts receivable file.
Figure 7-1. Index Corruption Recovery for a KSAMXL File
:BUILD ARMSTRXL.MGR.AR;REC=-80,,F,ASCII;DEV=DISC;&
DISC=100;KSAMXL;KEY=(N,4,6;&
B,10,25,RDUP;&
N,65,5,RDUP;&
B,70,3,RDUP;&
FIRSTREC=1;REUSE
:FCOPY