HP 3000 Manuals

General Format for Key-Driven Access [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

General Format for Key-Driven Access 

With the construct shown below, you can set up a primary or secondary key
(even a generic search value) and read subsequent values in the key
sequence.  The only thing you cannot do is set up a key value that
doesn't exist.  The first GET(CHAIN) determines the starting position in
the file.

     SYSTEM NAME, KSAM=FILENAME;               << OPEN AS A KSAM FILE          >>[REV BEG]
     DEFINE(ITEM) RECORD 80 X(1):
                  KEYN      X(5) = RECORD(1);[REV END]
     LIST RECORD;

     MOVE (KEYN) = "VALUE";                    << GIVE KEY A VALUE              >>

     SET(KEY) LIST(KEYN);                      << SET UP KEY/ARGUMENT REGISTERS >>

     GET(CHAIN) FILENAME, LIST=(RECORD);       << USE CHAINED ACCESS ON PRIMARY >>
                                               << KEY                           >>
     REPEAT
       DO
       GET(CHAIN) FILENAME, LIST=(RECORD), STATUS;
       DOEND
     UNTIL STATUS <>0;

     END NAME;



MPE/iX 5.0 Documentation