HPlogo Using KSAM XL: 900 Series HP 3000 Computer Systems

Chapter 5 Reading File Data

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

KSAM files offer multiple record retrieval options using primary and alternate keys, and logical and physical record numbers. The following list identifies the methods of reading KSAM file data:

  • Sequential access:

    • By primary key.

    • By alternate key.

    • In physical record order.

  • Random access:

    • By key value.

    • By logical record number.

    • By approximate key match.

    • By partial key.

    • By physical record number.

KSAM XL uses two types of pointers to identify the location of records to be read: the logical record pointer and the physical record pointer. The logical record pointer points to a key in the index, which points to a data record. This pointer is used to locate records by key. The physical record pointer points directly to a data record. This pointer is used to locate records by their physical location in the file.

Intrinsics that use pointers are either pointer-dependent or pointer-independent. Pointer-dependent intrinsics expect the pointer to be positioned in order to execute correctly. Pointer-independent intrinsics execute regardless of where the pointer is positioned.

KSAM XL maintains an advance flag to specify whether or not to advance the pointers before the specific function. If the flag is set to TRUE, pointers are advanced before performing the intrinsic function. If the flag is set to FALSE, the intrinsic function is performed without advancing the pointers first.

Intrinsics have been developed to position pointers and to read records in sequence or randomly, by key value and by record number. Table 5-1 “Pointer and Advance Flag Settings for Reading” identifies the intrinsics used to access files and identifies those pointers that are set by each.

Table 5-1 Pointer and Advance Flag Settings for Reading

IntrinsicReads Advance FlagSets PointerSets Advance FlagPointer Dependant
FFINDBYKEYnobothnono
FFINDNnobothnono
FPOINTnobothnono
FREADyesbothyesyes
FREADBYKEYnobothnono
FREADCyesPHYSyesyes
FREADDIRnoPHYSyesno
FSPACEyesbothnoyes

 

NOTE: COBOL II and Business BASIC provide KSAM file access routines that read records by key value. Refer to your programming language manual for details.
Feedback to webmaster