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

59
7 Protecting the File and Its Data
Attention must be paid to protecting a KSAM file's data. Check an intrinsic's status after
a call to find information about a failed routine. The FCHECK and FERRMSG intrinsics
provide error codes and messages after an intrinsic call has failed.
Various intrinsics control file access when a file is shared by more than one process.
Locking and unlocking the file controls access to a shared file during critical modification
operations.
The item numbers 2 and 6 of the FCONTROL intrinsic ensure that data is written to the disk
before processing is allowed to continue. This protects the data from system and software
aborts that may occur between the time that data is written to the transaction log and the
time that it is actually written to the disk. Transaction management provides automatic
recovery from system and software aborts.
Regular maintenance and file backups are needed for data protection against hardware
failures or improper processing. If index corruption exists, files can be restored quickly
through the FCOPY facility.
Checking Error Information
When a file intrinsic returns a condition code indicating that a physical input or output
error has occurred, additional details can be obtained by calling the FCHECK intrinsic. The
parameters of the FCHECK intrinsic can be designated to return the following error
information:
The error code that identifies the type of error that occurred.
The transmission log value that specifies the number of words not read or written
before the input or output error.
The relative number of the block involved with the error.
The number of logical records that were in the bad block at the time of the error.
This error information can be expanded to include a description of the error by calling the
FERRMSG intrinsic. This intrinsic uses the error code returned by the FCHECK intrinsic. By
supplying the returned FCHECK error code and defining a message buffer in the FERRMSG
intrinsic call , a corresponding message can be displayed from your program. The error
code returned by FCHECK and its corresponding message can also be found in the MPE/iX
Intrinsics Reference Manual.