The Keyed Sequential Access Method (KSAM) is a method of organizing records in a file according 
to the content of key fields within each record. As implemented for the HP 3000 computer 
system, KSAM/3000 is similar to and competitive with other indexed sequential access methods.
Every record in a KSAM file contains a primary key field whose contents determine the primary 
logical sequence of records in the file. Other key fields can also be defined so that the file can be 
sequenced in alternate orders. The order in which records are physically written to the file, the 
chronological order, can be the same as the primary key sequence or it can be unrelated to any 
logical sequence.
KSAM/3000 files can be accessed by programs written in any of these languages:
KSAM/3000 files can be copied, listed, and otherwise manipulated with the utility programs:
FILE ACCESS | 
  | 
Although separate in fact, the two files that comprise a KSAM file are treated as one file by the 
procedures that reference the file. The data file is the only file directly referenced by a user; the 
key file is updated by the system to reflect any changes to the data file and is not directly accessed 
by the user. Thus, from the user's point of view, accessing a KSAM file is very similar to accessing 
any other MPE file.
KSAM/3000 provides the following ways to store and retrieve data:
You can write records in logical sequence determined by primary key value or you can write 
records without regard to key sequence.
You can read records in logical sequence determined by either the primary or an alternate key value.
You can read a record selected at random by the value of its primary or alternate keys.
You can read records in the order they were written, that is, in chronological sequence, unless the program is written in COBOL or BASIC.
You can read a record selected by the value of its chronological record number, unless the program is written in COBOL or BASIC.
You can update all the contents of an existing record including the contents of the primary key field.
You can position to a record in the file according to its key value, its chronological record number, or its record number in key sequence.
  | 
  |   | 
  | 
  | NOTE: KSAM files are sequenced in ascending order only, not in descending order. Character keys are ordered by the ASCII collating sequence 
where numbers precede letters, not in the EBCDIC sequence where 
letters precede numbers. Numeric keys are ordered in algebraic order. | 
  | 
  |   | 
  |