HPlogo Using KSAM XL and KSAM 64 > Chapter 5 Reading File Data

Sequential Access by Primary Key

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Many processes retrieve records in a sequence, to systematically perform a function on each record. The primary key sequence is usually used for such routines. The file opening routine (an HPFOPEN or FOPEN intrinsic call) prepares for the most common record retrieval method by positioning the pointers at the record containing the lowest value of the primary key. A call to the FREAD intrinsic, after the file is opened, reads the first record in the primary key sequence.

After reading the first record, the logical record pointer remains in the same position. The next FREAD repositions the logical pointer as well as the physical record pointer to the next sequential record in ascending key sequence and reads the record. Although FREAD may position both pointers, it uses the logical data pointer to locate the particular record. An end-of-data condition occurs when the last logical record is passed. At this point, the CCG condition code is set and returned to your process.




Chapter 5 Reading File Data


Sequential Access by Primary and Alternate Key