Simulating an Approximate Key Search [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
Simulating an Approximate Key Search
Transact does not support true approximate key searches. This example
shows a method of using Transact to achieve the same results as with an
approximate key search.
The first GET(CHAIN) determines the starting position in the file.
Subsequent reads follow the key sequence and read all values greater than
or equal to the key value defined. The initial key value must exist.
SYSTEM APROX,KSAM=KTRAN3; << OPEN AS KSAM FILE >>
DEFINE(ITEM) KARRAY 80 X(1):
KEY1 X(5)=KARRAY(1); << DEFINE KEY >>
LIST KARRAY, INIT;
MOVE (KEY1)= "SSSSS"; << GIVE KEY INITIAL VALUE >>
SET(KEY) LIST(KEY1); << SETUP KEY/ARGUMENT REGISTER >>
GET(CHAIN) KTRAN3, LIST=(KARRAY); << USE GET(CHAIN) TO READ >>
DISPLAY; << FIRST RECORD >>
REPEAT << USE GET(CHAIN) WITH STATUS TO CONTINUE READING IN KEY >>
<< SEQUENCE AND TO PREVENT STOPPING WHEN KEY VALUE CHANGES >>
DO
GET(CHAIN) KTRAN3, LIST=(KARRAY),STATUS;
DISPLAY;
INPUT "DO YOU WANT TO CONTINUE (YES/NO)?";
DOEND
UNTIL INPUT = "NO";
END APROX;
MPE/iX 5.0 Documentation