Date:         Tue, 21 Mar 1995 17:22:46 EST
Reply-To:     The NOMAD2 Discussion List
Sender:       The NOMAD2 Discussion List
From:         "William J. Ryan"
Subject:      Complex matching

--- Original question:

 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.

--- First response:

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


--- Originator's reply:

      Bill,
           I have to go to a third master and using k1 to match to k3
           and check on a code in the 3rd master. if item of master
           three among(a,b) then I take record with key1 and match
           k3 along with the code from third master. external file
           will have info from third master.
                                            Thanks ..Dave


--- Response:

Dave,

Sounds like an interesting problem, but hard for me to comprehend without
more details.

1. Do you have something running and is the problem efficiency?  If so, perhaps
 you
   could boil it down to the essence of the problem (mininum schema and
 procedure)
   and get us a shot at it.

2. Is the problem that you can't get anything to work?  If so, perhaps
   a listing of schema and a idea of the end-product you're trying
   to produce might clear up the problem.

Problems of the "type 1" are usually easier to solve remotely than
those of "type 2", unless the nature of the problem (i.e. inexact
lookups) can be clearly expressed.

Good luck!

Bill
back to index