Guardian Procedure Calls Reference Manual (G06.25+)

Guardian Procedure Calls (H-K)
Guardian Procedure Calls Reference Manual522629-013
7-59
KEYPOSITION[X] Procedures
(Superseded by FILE_SETKEY_ Procedure)
No searching of indexes is done by KEYPOSITION; therefore, a nonexistent or
duplicate record is not reported until a subsequent READ, READUPDATE,
WRITEUPDATE, LOCKREC, READLOCK, READUPDATELOCK, or
WRITEUPDATEUNLOCK is performed.
KEYPOSITION and disk seeks
KEYPOSITION does not cause the disk heads to be repositioned; the heads are
repositioned when a subsequent I/O call (READ, READUPDATE, WRITE, and so
forth) transfers data.
Positioning exact
If an exact KEYPOSITION is performed, and a
compare-length is specified
which is less than that specified when the file was created,
compare-length
must match the variable key length specified when the record is entered into the
file. Otherwise, a subsequent call to READ, READUPDATE, WRITEUPDATE,
LOCKREC, READLOCK, READUPDATELOCK, or WRITEUPDATEUNLOCK is
rejected.
Current-state indicators after a KEYPOSITION
Current-state indicators following a successful KEYPOSITION are:
current position is that of the record indicated by the
key-value, key-
specifier, positioning-mode, and key-length, or the
subsequent record if
positioning-mode.<0> is set to l.
positioning mode is from
positioning-mode if it is supplied; otherwise, it is
approximate mode.
compare length is determined as follows for generic searches:
IF length-word.<0:7> <> 0
THEN length-word.<0:7>
ELSE
IF length-word.<8:15> > length of key-specifier
THEN length of key-specifier
ELSE length-word.<8:15>
Positioning to the middle of a duplicate alternate key
Positioning with an alternate key is usually done by giving the alternate key value
you want. This always positions the file to the first record of the set of records that
contains duplicates of the specified alternate key value.
To position to an arbitrary record within the set of duplicate records, you can
specify a
key-value consisting of the alternate key value concatenated with the
primary key value of the desired record within the set, and specify the
key-
length as the sum of the alternate key length and the primary key length (except
for insertion-ordered keys).
Saving current position