     function search( key : typekey; var r : dataarray ) : integer;
     var i : integer;

     begin
     r[n+1].k := key;
     i := 1;
     while key <> r[i].k do i := i+1;
     if i <= n then search := i    {*** found(r[i]) ***}
               else search := -1;  {*** notfound(key) ***}
     end;
