HPlogo Using KSAM XL and KSAM 64 > Chapter 7 Protecting the File and Its Data

Recovering from Index Corruption

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

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 >FROM=OLDMSTR.MGR.AR;TO=(ARMSTR.MGR.AR);KEY=0 >EXIT
Figure 7-2 Index Corruption Recovery for a KSAM64 File

  :BUILD ARMSTR64.MGR.AR;REC=-80,,F,ASCII;DEV=DISC;&
  DISC=100;KSAM64;KEY=(N,4,6;&
  B,10,25,RDUP;&
  N,65,5,RDUP;&
  B,70,3,RDUP;&
  FIRSTREC=1;REUSE
  :FILE ARMSTR64; KSAM64
  :FCOPY
  >FROM=OLDMSTR64.MGR.AR;TO=(*ARMSTR64.MGR.AR);KEY=0
  >EXIT




Backing Up KSAM Files


Chapter 8 Migration and Mixed Mode Processing