vbdpss.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Article Q79149
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 How to Remember Current ISAM Record for Different Indexes - Q79149
 
 Method 2
 --------
 
 A temporary variable can be used to maintain the key value(s) for the
 current record for the desired index. These key values could be used
 in a SEEKEQ statement when the original index is returned to, making
 the record with those key values the current record. Assume the
 following type and index are used in the example below:
 
 TYPE DataType
   Element1 AS STRING * 15
   Element2 AS CURRENCY
 END TYPE
 
 DIM Temp AS DataType
 OPEN "test.mdb" FOR ISAM DataType "tabletype" AS #1
 CREATEINDEX #1, "One", 1, "Element1", "Element2"   ' Note Unique Index.
 SETINDEX #1, "One"
 ...
 RETRIEVE #1, Temp      ' Marker for record to return to.
 SETINDEX #1, "Two"
 ...
 SETINDEX #1, "One"
 SEEKEQ #1, Temp.Element1, Temp.Element2     ' Return to marked record.
 
 When this is done, the unique index property ensures that the current
 record is the same as it was when the index was changed away from
 index "One". This method is much faster than the previous one because
 ISAM does the searching; however, this method requires that the index
 in question be unique so there is only one possible record for the
 SEEKEQ statement to find. With a non-unique index, this method may
 not find the desired record, because there could be several records
 that match the seek criteria.
 
 The element Temp.RecordPosition can be used as a marker in correlation
 with the second part of Method 1 (for example, Index1Pos =
 Temp.RecordPosition). Index1Pos can be used to count to the record
 that was current when the index was last used. Also, any time a
 RETRIEVE is done with index "One", the associated record number can be
 displayed (for example, LOCATE 25, 77: PRINT Temp.RecordPosition).
 Note that the RecordPosition field of records would have to be updated
 any time records are INSERTed, UPDATEd or DELETEed, because these
 operations could change the order of the records in the index.