[futurebasic] Reading Records Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1998 : Group Archive : Group : All Groups

From: MAWRPh <MAWRPh@...>
Date: Mon, 30 Mar 1998 00:42:42 EST
I have an application that reads and writes records much like this.

'---------------------- Globals ---------------------------
DIM RECORD gMyRecord                       'sample mail list
  DIM 31 name$                                'record
  DIM 31 address$
  DIM 31 city$
  DIM 31 StateZIP$
DIM END RECORD_gMyRecord
END GLOBALS
  
'---------------------- Functions -------------------------
LOCAL FN readRecord (fileID, recNum)
  RECORD fileID, recNum                   'pos file pointer
  READ #fileID, gMyRecord                 'read record in
END FN

LOCAL FN writeRecord (fileID, recNum)
  RECORD fileID, recNum                   'pos file pointer
  WRITE #fileID, gMyRecord                'write record out
END FN

I would like to be able to read in or write out just a single field of a
record at times. How do I position the file pointer to just read in one field?
How do I know where to set the file pointer?

LOCAL FN readRecord (fileID, recNum)
  RECORD fileID, recNum, address%  <=== How do I know what number to use here?
  READ #fileID, gMyRecord.address$  <=== Will this get me just the one field
text I want?
END FN

Also, is just reading one field in this way faster than reading the whole
record, or does it really make much difference? My application reads a lot of
records so I want it to be as fast as possible.

Thanks
Mark