[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:21:09
|
Just after hitting the send button I re-read my post and found all the mistakes I had made! :-( Please delete the previous message and use this one instead: I imagine that the INDEXED, 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 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 will need to be added to the library to implement the additional 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, "2" to skip a 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=PART$" 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 contains the "Partnum" information then an IOLIST could be written as either "IOLIST #8=PART$" 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 |