Re: Equates, object size and speed



RE:
I actually find that less clear than this:
EQU DRNAME.AMC to 1

This is the approach I prefer, also. It has the advantage of being
readable for any situation where the attribute must be referenced:

Dimensioned array access:
X = DEBTOR( DRNAME.AMC )

Dynamic array access:
X = DEBTOR< DRNAME.AMC >

READV / WRITEV:
READV X FROM DEBTOR.FILE, DEBTOR.ID, DRNAME.AMC THEN...
WRITEV X ON DEBTOR.FILE, DEBTOR.ID, DRNAME.AMC

You can also use these (numeric) equates for dynamic array work
(INSERT, DELETE, EXTRACT, REPLACE), and in LOCATE statements.

Finally, you can use the same names for your EQUs as you use for DICT
items, so BASIC and TCL users "say" the same thing when referring to a
given field.


Using the EQU DRNAME TO DEBTOR( DRNAME.AMC ) doesn't work for me
because it's too limiting:

You HAVE to use MATREAD, creating maintenance work when new fields
are added to a record. (You can defer this somewhat by DIMming larger
than necessary, but eventually...

You CAN'T use the EQU symbol if you're processing more than one
record, because it's tied to the one named DIMmed array. (Consider how
you'd compare two debtor records, for example.)

You "lose" the visual connection between the field and the record
it belongs to. What I mean is this: If you have an app with debtors
and, say, doctors, what does DRNAME mean? Is it a debtor's name, or a
doctor's name? Using numeric equates, you write one of these lines of
code:
X = DEBTOR( DBTNAME.AMC )
<< or >>
Y = DOCTOR( DOCNAME.AMC )
Later, when reading the code, there's no question as to the what's in
X or Y. It's right there in the source code you're looking at; there's
no need to refer back to the EQUs.

As stated in the original post (and repeated a couple of times in this
thread), speed just isn't an issue these days. (With the exception of
high-volume batch processing jobs.)
.



Relevant Pages

  • Re: Equates, object size and speed
    ... Dimensioned array access: ... X = DEBTOR< DRNAME.AMC> ... Using the EQU DRNAME TO DEBTORdoesn't work for me ... and, say, doctors, what does DRNAME mean? ...
    (comp.databases.pick)
  • Re: Equates, object size and speed
    ... I definitely do not however define the numerics as anything other than ... Dimensioned array access: ... X = DEBTOR< DRNAME.AMC> ... Using the EQU DRNAME TO DEBTORdoesn't work for me ...
    (comp.databases.pick)