[Mybusinessbasic-devel] Thoughts on file types and I/O
Status: Alpha
Brought to you by:
mikecurry1974
From: Michael S. L. <mi...@ha...> - 2003-12-29 23:09:09
|
I'm gathering my thoughts before creating the specification for file I/O and was wondering if anyone wanted to throw their ideas into the mix. I imagine that the SORT and DIRECT file types will be added first as they will be the least controversial. ;-) Here are my thoughts so far. Please comment. 1) Indexed files should be easy enough to implement using either standard file I/O or with some of the functions from the PBL Base functions. 2) The "Keyed" file type can be used to implement SORT files. 3) The "ISAM" file type can be used to implement DIRECT files. 4) The "ISAM" file type can also be used to implement MULTI files; however, new code may need to be added to the library depending on the features we will want (It's been a long time but if I recall correctly, the MULTI class will inherit the ISAM class and add onto it). 5) We should add a "DIR=" function to be used in READ statements that will indicate the direction of the read. The default is to be "1" indicating that the next record should be read. Other possible values include "-1" to read the previous record, "0" to re-read the current record, you get the idea. 6) Fields in Multi-keyed files should be named and access should be permitted by name as well as by field number. For instance if field number 8 in a file is named "Partnum" then an IOLIST could be written as either "IOLIST #8=PARTNUM$" or "IOLIST #PARTNUM=PART$" or more traditionally as "IOLIST *,*,*,*,*,*,*,PART$" 7) Fields in direct files should not be named and access should be permitted only by field number. For instance if field number 8 in a file is named "Partnum" then an IOLIST could be written as either "IOLIST #8=PARTNUM$" or more traditionally as "IOLIST *,*,*,*,*,*,*,PART$" 8) The key fields in multi-keyed files can be used in the "KEY=" function to specify which of the keys to use for access. For instance if the "Partnum" field is designated as a key field then a read command could be written as follows "READ (1,KEY=#PARTNUM=PART$)A1$,A2$,A3$..." or as "READ (1,KEY=#8=PART$)A1$,A2$,A3$..." -- Michael St. Laurent Hartwell Corporation |