Combining Files

Authors

Publication

Pub Details

Date

Pages

See all articles from Extensions issue 4

Combining files is another of those routines which can change the way you approach PRO/FILE. In my case, I have lists of band music for Georgia. There are 6 lists, but there is only enough room in the program for 2 at a time. Originally I had one file containing lists 1 and 2, another with 3 and 4, and another with 5 and 6. Unfortunately, at the beginning of the year my junior high band is dealing with the first and second list, but later moves on to the second and third. Meanwhile, the high school starts with 3 and 4, and later with 4 and 5. Some years they end up with 5 and 6. This made it difficult to have all the music 1 wanted for a particular band in the computer at the same time.

The ability to combine files solves all that. Now I keep a separate file for each list (in my case this is on a microdrive cartridge), and load in the first file I want and then merge in the second. The flexibility is great for my needs.

The routine works like this. Anytime you want to load a file, the computer will ask whether you wish to LOAD or MERGE the file. A load acts as you would expect, but merge keeps whatever file is in the computer and adds the new one on to the end of it. Obviously, the total amount of data of each file cannot exceed the size of D$ or you program will crash and you will have to start over with the master copy. It is up to you to avoid this situation!!!

When you merge another file, you must delete the file which used to say “SEARCH IS COMPLETE”. However, since this is temporarily altered during a data save it will now hold the name of the file followed by the value of P, and then the remaining characters normally in the file. This should be deleted since you already have a “SEARCH IS COMPLETE” file. Just search for the file name and you should see the file come up. Now just enter “D”* to delete it.

Your files are now combined with the garbage removed. Please note that with dated files, the program retains the date from the first file loaded, however, the program wil] change to the name of the last file merged. If you want to change the name remember to input “NN” at the main menu.

Besides my use of this routine, there is at least one other use, Suppose you have several people who want to create a particularly large set of files. Each person could be assigned a section of the work and later each section could be combined!

Make the following changes:

5505 PRINT AT J+U,U;"   LOAD DATA ONLY? (Y OR N)   ": PAUSE O: LET X$=INKEY$: IF X$="Y" OR X$="y" THEN PRINT AT VAL "18",G;"L)OAD OR M)ERGE?": FOR X=U TO J: NEXT X: PAUSE O: LET P$=INKEY$: IF P$<>"M" AND P$<>"m" THEN LET P=U
5506 IF X$="Y" OR X$="y" THEN LET P=P-U: LOAD ""CODE PEEK VAL "23627"+R*PEEK "23628"+P+G-U: LET F$=D$(P+H TO P+G+F): LET P=P+VAL D$(P+K+H TO P+J+U): BEEP U/H,J+J: GO TO U
5509 IF X$<>"N" AND X$<>"n" THEN GO TO VAL "5505"

If you are using Sinclair microdrives, then also change:

5803 CLS : PRINT AT K,G;"L)OAD OR M)ERGE?":PAUSE 0: LET Q$=INKEY$: IF Q$<>"M" OR Q$<>"m" THEN LET P=U
5805 LET P=P-U: LOAD *"M";U;F$CODE PEEK VAL "23627"+R*PEEK "23628"+P+G-U
5806 LET F$=D$(P+H TO P+G+F: LET P=P+VAL D$(P+K+H TO P+J+U): BEEP U/H,J+J: GO TO U

Speaking of microdrives, making the following changes will allow you to select any drive you want when saving or loading data:

5503 CLS : PRINT AT K,O;"T for Tape or 1-8 for microdrive": PAUSE 0: LET P$=INKEY$: GO TO VAL "5503"+(U AND P$="T" OR P$="t")+(VAL "297" AND P$>"0" AND P$<"9")
5800 LET X=VAL P$: PRINT AT J+U, F;"INPUT FILE NAME TO LOAD",: INPUT F$: IF LEN F$<U OR LEN F$>K THEN GO TO U
5805 LET P=P-U: LOAD *"M";X;F$CODE PEEK VAL "23627"+R*PEEK VAL "23628"+P+G-U
8202 CLS : PRINT AT K,O;"T for Tape or 1-8 for microdrive”: PAUSE 0: LET P$=INKEY$: GO TO (VAL "8300" AND P$>"0" AND P$<"9")+(VAL "8205" AND P$="T" OR P$="t")
8300 LET X=VAL P$: CLS : IF X$="D" THEN LET D$(H TO G+F)=F$: LET
D$(K+H TO J+U)=STR$ P: ERASE "M";X;F$: SAVE *"M";X;F$CODE PEEK VAL "23627"+R*PEEK VAL "23628"+G-U,P: VERIFY #"M";X;F$CODE PEEK VAL "23627"+R*PEEK VAL "23628"+G-U

Products

Downloadable Media

 
Scroll to Top