[comp.databases] DB3 III and MATH ??

nacer@mist.cs.orst.edu (Abdenacer Moussaoui C.) (01/20/88)

From what I have tried there is no support for sin() cos() functions.
May be clipper supports them however I don't want to loose the interpretive
mode of db3+ at least at this stage.

(1)  I think db3+ supports some sort of object code LOADing and CALLing
     has anybody
     implementated such "basic" trig stuff in whatever (asm,c,...) ???
      
(2)  Is there such thing as user-defined function in db3+?

(3)  How to go about seting up some mem-vars to simulate predefined constants
     such as PI for example?  
     
(4)  Ideally I would like to have these suppositely constants in database
     where they could be easily modified and then set again.
     I tried a simple 2 field database with name and value fields
     then I used:
     USE CONST.DBF
     DO WHILE  .NOT. EOF()
      STORE VALUE TO &NAME		&& store value in the variable contained
     					&& in the field NAME
      SKIP
     ENDFO
     this would have been great if it worked.  I think for such thing to
     work implies that mem-vars need to be allocated on the heap and not in
     the *fixed* data-segment.
     
    
      
     

Thank you.
--nacer

tr@wind.bellcore.com (tom reingold) (01/30/88)

At my last job, I programmed in dBase III extensively and I think
I still remember it.  (I left in spring '87).  I had to use so many
tricks to compensate for the bad design of dBase III.

I had at least two solutions to problems similar to yours.  One is
to buy dBase Tools for C.  This is 1) a library of routines that
are loaded into memory and callable from dBase.  The calling sequence
and the setup procedure is so bad, I would not recommend this
package.  It is also 2) a way by which you can write functions to
add to the ones that are loaded in memory.  I never got around to
trying it because it had the disadvantages of (1) and a screwy way
of writing the additional routines.  I hope Ashton Tate programmers
someday get shot for their designs.

Another solution seems more kludgy but works better.  Get your data
into a small temporary database.  I assume you can do this.  Then
use the "copy to <file1> delimited with blank" command.  This will
create a text file that a C program can read.  Then from within
your dBase program, run the C program with "run myprog".  The C
program will read in the text file, do the calculations, then write
out a new text file.  Then in your dbase program, use a new and
empty database and grab the data using the "append from <file2>
delimited with blank" command.  Then move this data back into your
main database.

One bug in this second solution is that the computer tended to hang
if I did many "run" commands and I had to start over.  I think
"many" means about 75.

The "copy" command can operate on a range so that the data you are
sending to the first file may not have to be in a temporary database.
You may be able to use "copy rest to <file1> delimited with blank"
or something like that.

Any more questions?

Tom Reingold                    INTERNET:       tr@bellcore.bellcore.com
Bell Communications Research    UUCP:           rutgers!bellcore!tr
435 South St room 2L350         SOUNDNET:       (201) 829-4622 [work]
Morristown, NJ 07960                            (201) 287-2345 [home]