John Christian ([EMAIL PROTECTED]) wrote

> OPEN "DICT","MY.FILE" TO @DICT ELSE STOP
> (@DICT is required to work with virtual fields)
>
> READ @RECORD FROM F.MY.FILE,KV.MY.FILE ELSE PRINT "ERROR
> F.MY.FILE: ID = ":KV.MY.FILE
> (@RECORD required.  Virtual fields are in MY.FILE)
>
> CLIENT.NAME = {DONOR.NAME}
> (Uses virtual field DONOR.NAME in MY.FILE)

Just to be clear - the curly braces {DONOR.NAME} notation is just a UniData
shorthand for the CALCULATE() function.  There is also the Prime/UniVerse
compatible ITYPE() function but it is IMHO not nearly so nice to work with.

And also, to be clear, I completely disagree with those who suggest that
accessing a dictionary item by name from inside a BASIC program is a bad
idea because of either inefficiency or some other mythical danger.  Code
reuse is good.  Unreservedly good.  I simply don't subscribe to the NIH (not
invented here) approach.

If you can't code the dictionary item efficiently and access it from BASIC,
then code it efficiently in BASIC as a FUNCTION/SUBROUTINE and access it
from the dictionary via SUBR.  Either way it is far better to get the same
result from multiple means than to be hyper-efficient, but have subtle
differences in the boundary conditions.

Cheers,

Ken

Bill Stinocher wrote:

> Hello all. Being new to UniData, I hope that maybe someone
> can help me.
> How do you read an I descriptor in a UniBasic program? The IBM manual
> gives me a hint (looking at the CALCULATE command), but the example
> given uses a select on the entire file. I am looking for a way to read
> the actual data and the I descriptor within a loop without using a
> select. I'm familiar with opening, reading, updating, etc. the data
> portion of a file, but not the dictionary.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to