QL Mail File Hints

See all articles from Update April 1989

I received from Dick Wagner some comments and questions about the UPDATE listing and the issue disk/mdv version which suggested that the info I sent him might be helpful to other users also. Because it was written with the intention of demonstrating some elementary Super Basic programming concepts which can be modified and enlarged upon by the user it obviously lacks many of the refinements and features of Archive, which can be used for mail files and much, much more.

Perhaps I should also mention that the listing and the accompanying text in the October UPDATE were both typed into TASWORD on my 2068 because at the time I didn’t have a printer hook-up with my QL that would produce a decent master for Bill to copy. Also, I only had a QL that was working properly or at all about 2 months of the 14 preceding last Christmas. The rest of the time it was either down or away for replacement or repair. I finally sent it to Dan Elliott who did the repairs right for me and also made some changes in the power supply so all voltages are pre-regulated outside the computer. This has eliminated about 90% of the heat build-up inside the case as well as the power surge, RFI, and oscillation problems. The display now is steady as a rock, even in TV mode.

The listing in the issue disk/mdv program is correct as is, but in the process of translating a Beta Basic version of the program to Tasword, I missed lines 160 and 170 in the UPDATE listing. They should have been:

160 CLS
170 IF c$ INSTR f$(n,1 TO 115) THEN GO SUB 200: PAUSE

It is interesting–and also can be very frustrating–that a definition such as f$(n) will work sometimes in a situation such as this and sometimes will not, so a full definition of all the parameters is the only sure way to go.

In the process of de-bugging the issue MDV/disk version which allows user-defined and named fields of any length and number (within RAM limitations, of course!) I noted a quirk in the sort routine which sometimes keeps it from a correct sort with an even number of file-items. This was corrected by adding a counter (cnt) to lines:

30 LET m=last: LET s=m: LET cnt=0
40 LET s=INT(s/2): IF s<1 AND NOT cnt THEN RETurn
70 LET j=n: cnt=0
80 IF f$(j,21 TO 40)>f$(j+s,21 TO 40) THEN LET x$=f$(j,1 TO 115): LET f$(j,1 TO 115)=f$(j+s,1 TO 115): LET f$(j+s,1 TO 115)=x$: LET j=j-s: LET cnt=cnt+1: IF j>0 THEN GO TO 80)

A printer formatting routine was purposely not included in the program as given because practically every kind has different command-sequences. For example, to set a 45th column left margin for addressing envelopes on my C. Itoh 8510 this sequence would be needed at line 1300:

1300 OPEN #7,SER1: PRINT #7,CHR$(27);"L045": CLOSE #7: GO TO 500

A universal left margin setting may be provided by the following, using lm$ as PRINT #7,lm$;f$(n, slice):

1300 INPUT "Left margin col: ";lm: lm$="": lm$=lm$ & FILL$(" ",lm): GO TO 500

The prompt in line 980 of the printed listing would probably be less confusing if made “Key ENTER to Keep, $STOP, or % to delete item LINE # to EDIT”. The entire file-item is deleted and the last-item counter is decremented by one if % is entered as the very first input. An item-line to be edited is selected by a first-input of a single digit, 1-6. The re-definition of f$(n,21 TO 40)=”zzzzzzzzzz” during a delete is used to properly re-order item(s) to be deleted to the bottom of the file instead of to the top where they would otherwise go if sorted after f$(n,1 TO 115)=””. A full definition is needed here instead of just f$(n)=””.

One of the drawbacks of using arbitrarily-defined fields for data such as this is that the ones that work fine for me may not meet your requirements. To enlarge the sizes of the respective fields beyond the total of 114 characters (plus the one in 115 for first-name length) the DIM f$() statement must be changed in line 770 in the printed listing. Then every line must be changed that defines f$(n,1 TO 20) for first-name field, f$(n,21 TO 40) for last-name field, etc. With a 400-item dimension of the f$ array the sorting time takes several minutes when the file is filled to this size so you might want to do sorts only after an EDIT and from the menu instead of following every set of new entries.

The “y/n” options as given accept only lower-case inputs which may be changed in lines like 350 in the printed listing to: IF y$=”y” OR y$=”Y” THEN . . . .

Those who have the issue disk/mdv version also have two versions of a menu-loader routine which resides in the BOOT file and displays up to 36 file names. Unlike the auto-directory 2068 users have with their SDOS routine this one requires manual input of each name in the menu, but only a single key-stroke then is needed to LRUN the file selected. The one version saves and loads as data this user-entered directory and the other version brings down into edit mode a string-definition line into which a file name is entered. The latter loads more quickly since all the data is contained in the listing itself rather than in a separate data file.