76 Lh
Ljc,m2,k32
LFREE FORM DATA FILER
LZ
LF
Ljc
L-- ## --
LZ
L
LThis is a LeScript file.
L
Ljb
LINTRODUCTION
L
LThe Free Form Data Filer is an attempt to simplify the storage ofLinformation. It is not a data-base manager in the usual sense as applied toLmicro-computers, rather it may be likened to the 'general information'Ldrawer of an office or domestic filing cabinet. There is no restriction onLthe type of information which may be filed; if it can be displayed on theLscreen, then it may be filed. It is incapable of the data manipulationLinherent in such systems as dBASE II or OPEN ACCESS. It is but one overlayLof an extensive data processing system devised by the author.
L
LThis particular system may be implemented only on a TRS-80 Model 4, or 4P,Loperating under TRSDOS ver. 6.2., using the BASIC interpreter. It would be aLrelatively simple matter to convert it to operate under CP/M, using theLMBASIC interpreter. Implementation under alternative operating systems, orLother BASIC interpreters, or on other machines would necessitate anLextensive modification to the code. (Programmers may care to study theLtechnical notes at the end.)
L
LNOTE: Do not attempt to compile this program. It will not run.
LIL6
FIn any case, any speed advantage would not be observable.
Fil0
L
L
LGETTING STARTED
L
L
LYour starting point depends to some degree upon the number of disk drivesLavailable. There are two data files associated with the system:-
LFDFDA/DAT and FDFSER/DAT. The first of these files will normally be muchLlarger than the second. Therefore, if you have the standard configurationLof two 40-track single sided disk drives, it is probably better if you optLto install FDFDA/DAT on drive 1, with FDFSER/DAT and FFDF62 on drive 0,Ltogether with the operating system and the BASIC interpreter. In theLinterest of storing a useful amount of information, it is suggested that allLother files be purged from drive 0.
L
LLoad BASIC and then load (only load - not execute) FFDF62. In order toLconfigure the program to your hardware, LIST line 20.
L
Lil4
H30 DATA "0","0"
H
Hil0
LEnter EDIT mode, and change the second 0 to 1. Be extremely that youLneither add nor delete any characters in this or any other line.
L
LThe effect of this change is to cause the program to write the fileLFDFSER/DAT to drive 0, and FDFDA/DAT to drive 1.
L
Lil45,g1
.FDFSER/DAT is a sequential.index file.
.
.FDFDA/DAT is a direct access.(random) file in which the bulk.of the data is stored - hence.the provision for the larger.size.
.il0
L
LWhere the user has greater capacity disk drives, he will have to make aLjudgement as to the disposition of data files based on the nature of theLdata to be written. For example, the author has one single sided 40Lcylinder, and two double sided 80 cylinder drives. Most data files, as wellLas the program file FFDF62, are written to either drive 1 or 2.
L
L(There is an alternative program which spans multiple disks; in the one fileLwhere this is used, the index file FDFSER/DAT is located on drive 1, and theLprogram prompts for the appropriate number disk to be mounted on drive 2.)
L
LDon't worry too much about this selection procedure; it may be changed laterLwithout incurring any disadvantage. You will have a much better idea afterLyou have a few hundred records written and then examining the relative sizesLof the resultant files by means of the DIR command.
L
LBefore you can write any records at all, you must first initialize theLfiles. RUN the program, and select option -
L
Lil22
65 Initialize New Disk
6il0
L
LRespond to the prompts appropriately, maintaining consistency with theLoptions chosen in data file/drive number configuration previouslyLdescribed.
L
LYou may now choose the option to input data - there's not much else you canLdo at this stage!
L
L
LDATA STRUCTURE AND INPUT
L
LBeing a free-format system, there are few restrictions on the nature of dataLentry. You may freely use commas and semicolons anywhere; they no longerLserve as record terminators. You may use graphics or special charactersLsuch as the Greek alphabet etc. by using the control keys defined in theLModel 4 Disk System Owners Manual. (Appendix A - pp. 56 et seq.).
L
LHaving chosen the data entry option (1), you are prompted to select one ofLthe following:-
L
Ljl,il28
0<L>ine Input Mode
0<C>ursor Addressing Mode
0<T>erminate
0
0il0,jb
LThe selection of T returns you to the options menu.
L
LSelecting L enables you to input text data line by line.
L
LSelecting C makes available full screen editing using cursor addressing.
LHaving selected either L or C option, you will be prompted to input aLheading. This is, in fact, the index upon which later information searchesLwill be made. Intelligent use of this indexing facility demands that theLuser try to make each record as unique as possible. For example, in a listLof names you come across one Fred Bloggs. Now, we all know there areLhundreds of Fred Bloggs' in this state. But not all of them are printersLwho live in Fremantle. So, an entry:
L
LFRED BLOGGS PRINTER FREMANTLE
L
Lis unlikely to turn up more than two or three (Unless you are heavily intoLBloggs' - in which case, add another means of identification - say, FREDLBLOGGS SNR PRINTER FREMANTLE).
L
LAt this point, it should be pointed out that the information retrieval partLof the program is unable to deal with more than five criteria; but it wouldLbe unusual to be confronted with a five-point match which still left a userLwith more than three or four records to look at. More of this later.
LThis is not to say that you are limited to five words in the index heading;Lfrequently, it will be advisable to enter quite a long heading to allow forLquite complex search criteria. Nevertheless, in the interest of keeping theLindex file reasonably small, hence reasonably fast, it is recommended thatLentries be restricted to the bare essentials. The data may be amplified inLthe text file. On the other hand, be cautious about cryptic entries - youLmay never be able to find your data again! Experience is certain to be yourLbest tutor. It does not matter whether you enter the heading in upper orLlower case; in any case it will be converted to upper case by the program.
L
LIMPORTANT 	**** Each word must be separated by only one space ****
L
LTerminate the index entry with ENTER.
L
LYou will be asked whether the entry was correct. Upon receiving the answerL"Y", and assuming you elected the option <L>ine Input Mode, you will beLprompted to input text, together with a line of graphics characters whichLwill be over-written by the text you enter. A degree of caution is in orderLhere: This is not word-processor type input. YOU must watch for the end ofLthe line; if you go over it, text will be truncated. As well, there is noLediting facility at the input stage. If you have made only small errors,Lperhaps it may suffice to complete the entry and fix it up by choosing theLEdit option from the main menu. If, on the other hand, you have made a realLhash of it, you can always press BREAK, type CLOSE, and re-run the program.LAll previous records are safe; you will lose only the record upon whichLentry is currently in progress.
L
LWhen you feel you can get no more text into the current line, press ENTERLand continue on the next. When you have concluded text entry for a record,Lenter @ as the first character of a new line and press enter. The entireLrecord is then written to disk, and you are returned to the sub-menu whichLenables you to select the options <L>ine Input Mode -or- <C>ursor AddressingLMode -or- <T>erminate. When you have no more records to enter, type T atLthis prompt to terminate your data entry session. You will be returned toLthe main options menu.
L
Lg1
LProvision for up to 100 lines of text has been made. This represents someL8000 characters per record; though in practical terms it is likely thatLsomething of the order of 7500 characters is more representative due to theLprobability that the last letter of each line will not coincide with theLlast available position.
L
LShould you desire to leave a blank line, merely enter a space as the firstLand only character and press ENTER.
L
LUpon subsequent retrieval of data entered in the Line Input Mode, displayLwill be in "pages" of 18 lines. To afford you the opportunity of groupingLyour data logically where you expect to use more than one page, you areLadvised when the last line of a page is about to be input by means of aLmessage imbedded in the line of graphics characters. 
L
LThere is one bug which you may find disconcerting: When you enter aLcharacter into the last graphics block on a line of text entry, theLsubsequent input is displaced two lines down. The data recovered later doesLnot exhibit this characteristic.
L
LIf you elected the Cursor Addressing Mode, you will be presented with aLblank screen (except for the bottom comment line).
L
LIn this full-screen cursor addressing edit mode, you may move the cursorLanywhere in the top 21 lines of the screen by means of the arrow keys andLthe space-bar. The right-arrow maintains it's customary TAB function. TheLarrow keys move non-destructively; the space-bar is destructive. Thus youLmay position the cursor with the arrow keys and write, overwrite, or eraseLdata by means of the space-bar. It does not matter in what order data isLwritten to the screen; it is not placed into memory until you signify thatLyou have finished by pressing CTRL-T. The boundaries of the 21 line spaceLavailable to you are protected by the program.
L
LOne screen is ALL you get! If that is insufficient, about the only recourseLavailable to you is to make another identical index entry and file yourLsubsequent screen under that. Both will be displayed in turn when the indexLrecord is retrieved. Messy, but it works! You should really consider theLalternative of entering the data in Line Input Mode
L
L
Lg1
LDATA RETRIEVAL 
L
LThe logical operators AND and OR are used as the basis for search criteria.LAll searches are conducted on the index; there is no provision for searchingLthrough the text. Perhaps the best way to describe the function is by way ofLillustration. Since the text part of the record plays no part in theLretrieval of both parts of each record, be aware that the following remarksLapply only to the index.
L
LConsider the index entry of the following records:
L
Lil4
HFRED BLOGGS SNR PRINTER FREMANTLE			Rec. No	1
HFRED BLOGGS JNR PRINTER FREMANTLE				2
HFEARLESS FRED BLOGGS PEST FREELOADER NUISANCE 		3
HSOURCES OF FREE SOFTWARE					4
Hil0
L
LIn response to the command line:
L
LFRED AND BLOGGS AND SNR AND PRINTER AND FREMANTLE
L
LOnly record No. 1 would be returned.
L
LFRED AND BLOGGS AND SNR OR JNR	Would return record Nos. 1 and 2
L
LFRED					Would return record Nos. 1 2 and 3
L
LSNR					Would return only record 1
L
LF					Would return record Nos. 1 2 3 and 4
L
LBLOGGS OR PEST OR SOURCE		Would return all records
L
LIn this contrived example, it will be obvious that the selection of recordsLis quite flexible, and it's practical application enables the user to narrowLdown the number of records selected quite dramatically. A little experienceLwith a short test file will quickly reveal how to best make use of thisLretrieval system.
L
LIt is possible to accommodate only 100 matching records. In the event thatLmore than this number of matches occurs, then an error message will beLdisplayed. The user will be required to define more stringent retrievalLcriteria. Should this not be possible, then perhaps your particular dataLmay well be a candidate for dBASE II et al.
L
LIt is suggested that you view all records before you decide that you want aLprinted copy. Some of the codes used to generate graphics and specialLcharacters will produce alarmingly spectacular results on most printers!
Lg1
LEDITING AND DELETION
L
LThe selection procedure for editing and deleting records is identical toLthat detailed for retrieval. When a matching record has been found, theLuser is asked whether this is that which is required. At this point,Lprocedures diverge. A significant difference is that records may be editedLonly one at a time. Up to 30 may be deleted - though there is no globalLdelete function.
L
LIn fact, the whole edit/delete function is very primitive, but since theLauthor intended to use this system for semi-permanent data, it suffices!
L
L
LEDITING
L
LThe user may:
L
Lil10
BEnter new data for the heading.
BRetain the original heading by pressing ENTER.
B
Bil0
LThe text associated with the heading will then be presented. AlterationsLmay be made as required. If no changes are required for a particular line,Lthen merely press ENTER to retain the original data. A line of spaces isLvalid data.
L
LA limitation of editing the text is that a line may not be deleted; it mayLbe only altered. A line of spaces is a practical way of "deleting" a line,Lbut it has the practical disadvantage of displaying a blank line(s) when theLdata is retrieved on some future occasion. You may not tab across to changeLone letter and press enter; you must re-enter the entire line. Primitive;Las previously pointed out!
L
LIt is important to note that the number of lines may not be changed.
L
LDELETIONS
L
LWhen a record has been selected for deletion, the user is prompted toLconfirm that deletion of each record meeting the selection criteria is to beLdeleted. In response to an affirmative reply, the record is marked forLdeletion, and will be passed over in any future selection process. Up to 30Lrecords may be deleted at a time.L
LThe user will note the option:		7. Compact Data File
L
LThe purpose of this option is to permit the physical purging of recordsLmarked for deletion from disk. When this option is selected, statistics onLrecords marked for deletion are displayed.
L
LUnless, or until disk space becomes critically diminished, it is suggestedLthat this action be deferred. The process, though automatic, is quiteLtime-consuming, and little real benefit is achieved by exercising thisLoption. Again, unless there are very many records marked for deletion, theLtime saving accruing from physical deletion is insignificant, since only theLindex file is sequentially scanned. The mechanical components of diskLdrives are certain to benefit from deferrment!
L
L
LPerhaps it is appropriate to note that the direct access text file is notLreduced by deletions, but the number of unassigned lines is increased by theLnumber of lines deleted. On the other hand, because if affects the speed ofLrecord retrieval, the sequential index file is reduced after compacting.
L
L
L
LCONCLUSION 
L
LThat's about all there is to the system. Inelegant it may be, but it isLnone-the-less emminently practical and seems to work well. It is noLsubstitute for dBASE II, but seems a worthwhile adjunct to other dataLprocessing programs accessible by chaining, rather than firing up CP/M inLorder to execute dBASE II. As well, constants may be readily passed toLother routines operating under TRSDOS 6.2 BASIC. Inevitably, because I hateLwriting documentation, some aspects of this work will be ineptly orLincompletely explained. Experiment!!!
Lg1
L
L
LPROGRAMMER'S NOTES 
L
LThe file structure is a variation on the indexed sequential method.
L
LFDFSER/DAT contains the index keywords, each separated by a space. AppendedLto this data is a pointer to the beginning record number of the associatedLdirect access record group, the number of records, and the disk number whereLthe record group is physically located. Index records which are associatedLwith Cursor addressing mode input are flagged by means of an imbeddedLCHR$(7). This is necessary in order to properly format subsequent display.
L
LFDFDA/DAT is a direct access file with a LRL=80 (50H). This record lengthLwas chosen because one record occupies exactly one VDU line; thus presentingLrecords in a group as continuous text or graphics.
L
LIt should be noted that multiple disk spanning is not available in the formLpresented here, but the facility is maintained for compatibility.
L
LAn examination of the code will indicate that the tokens for OR and AND haveLbeen POKEd into core after isolation in preceding code. Any alteration toLthe BASIC code necessitates a relocation of these POKES.
L
LThe file compaction routine picks off active records and rewrites them. ALLLrecords are re-written ... inept and long-winded, perhaps, but simple!
L
LTwo machine language routines, PIP and SCAN occupy 54 bytes of contiguousLRAM commencing at 0240H.Though I'm sure this location in RAM is used forLsomething, I have yet to discover what! SCAN and PIP are defined early inLthe BASIC listing, as is the POKE routine.
L
LHaving taken an inordinate, perhaps unreasonable, dislike to SOUND n,n - ILhave substituted a few bytes designated PIP. This routine is called toLattract the operators attention where appropriate. Entry is at 0240H.
L
LThe routine SCAN reads the screen at the conclusion of Cursor AddressingLInput Mode. It's entry is at 0258H. A buffer of 1920 bytes is maintainedLcommencing at EC80H. The VARPTR of the variable AE is stepped through theLbuffer in 80 byte increments, interposed by assignment of it's value to 21Lelements of the array AB(1 to 21).
L
LIt may be expedient to copy the file FDFSER/DAT to MEMDISK if frequentLaccess is contemplated, such as in an office environment. Naturally, theLsize of the file must not exceed the size of the pseudo disk. The increaseLin speed of scanning is dramatic. A simple JCL file is probably the safestLway of achieving this without catastrophe where non-technical users areLinvolved. Indeed, in such a case, perhaps the whole initializationLprocedure would be better handled by AUTO into a JCL.
L
LTime permitting, those interested in rewriting may contact the author for anLexplanation of the incestuous spaghetti coding!
L
Lil55
8Jeff Coles.
8                                                                                                                                                                                                                                                             