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

Chapter 7 61
Protecting the File and Its Data
Writing Directly to Disk
FREADBYKEY
FUPDATE
FUNLOCK
Writing Directly to Disk
The FCONTROL intrinsic's
controlcode
parameter settings identify the control operation
desired. A setting of 2 ensures that the requested output has been physically completed. (If
the file is shared, you must lock the file before calling the FCONTROL intrinsic with a control
code of 2.) A control code of 6 provides a similar function. It ensures that the requested
output has been physically completed and that the end-of-file has been written.
Recovering from a System or Software Abort
File recovery after a system or software abort is provided automatically through
transaction management. After a file has been created with the BUILD command or has
been created and loaded using the HPFOPEN or FOPEN intrinsics, it is attached to system
logging. If processing of a transaction is interrupted prior to its logical completion, the
transaction is rolled back before processing is allowed to continue. A transaction is rolled
back in the following cases:
A system abort occurs.
A process with an active logical transaction aborts.
A transaction aborts.
A transaction causes a deadlock condition.
If a KSAM file is created and loaded using FCOPY's NEW option, or an HPFOPEN or FOPEN
intrinsic call, transaction logging is not attached until the file is closed. This provides a
fast load mode that loads the file more quickly than if transaction logging was invoked. An
abort during this load process, however, is not logged. If an abort occurs when creating and
loading a file with FCOPY's NEW option or with the HPFOPEN or FOPEN intrinsic, restart the
file loading process.
To protect initial loading, use the BUILD command to create the file. The file is attached to
transaction management when the BUILD command is used. A file can also be attached
manually by creating and loading the file with the HPFOPEN intrinsic and specifying the
DOMAIN=CREATE option. With this option, the file is attached and system logging begins
with the first access.