Date:         Sat, 18 Mar 1995 16:14:36 EST
Reply-To:     The NOMAD2 Discussion List
Sender:       The NOMAD2 Discussion List
From:         "William J. Ryan"
Subject:      reading backward

Dave:

Response to your mail:

>       I have a master with 3 keys, key 1 is 099, key 2 is
>       a4 and key 3 is datetime. I am trying to match key 1
>       key 2 and +- 2 minutes on the datetime field to
>       an external file. Problem is I have to read file
>       backward. I have tried selecting each pass through
>       on ge  min(datetime) and max(datetime). Then I use
>       last and move backward using previous. It works
>       but very poor performance when I issue the last command.
>       Also poor performance  on the first previous command.
>       Selects are on keys: select xxx=key1, select xxx = key2,
>       select xxx le max datetime; Any help would be appreciated.

Assuming that you have:

        master t1 keyed k1,k2,k3;
          item k1 as 099;
          item k2 as a4;
          item k3 as datetime;

        master t2 type sequential;
          item f1 as 099;
          item f2 as a4;
          item f3 as datetime;

Is this the kind of thing you want to do?

        for each t1 do;
          ampset t1;
          select from t2 f1=&k1 f2=&k2 f3 btwn(&k3-120000, &k3+119999);
          (do what you want to with selected records from t2 here...)
        end;

This assumes that I have gotten the "plus or minus two minutes calculation"
correct with
datetime values.  Anyhow, if you need to do some procedural operation on these
tables, then I would expect access to t2 to be randomly fast (or slow).

However, if what you really need is a third table produced from t1 and t2, then
I would think that some more interesting set-based alternatives could be
discovered.

Can you explain which table you need to navigate backwards, and the reason for
this?

Bill Ryan, Information Works
back to index