###   Projekte und Informationen rund um den KC85   ### 
 

 

CFOG's PIP, March 1989, Volume 8 No. 1, Whole No. 69, page 6

Backup with Submit

by Benjamin Cohen

While we're talking about backup (if you're not making backups you should at least be talking about it!) here's a simple SUBMIT file that I use to back up my data files after I update them. If you are using MS-DOS you could make this in a BATch file, substituting appropriate MS-DOS commands as required.

01   echo off
02 echo Insert backup disk
03 echo Date added?
04 echo If not, abort, restart with date
05 echo on
06 pause
07 era b:/F*.upd
08 save 0 /F$1.upd
09 era /F*.upd
10 save 0 b:/F$1.upd
11 pip b:=a:FILE.dta
12 go b:=a:FILE.inx
13 echo off
14 echo insert another backup disk
15 echo press A to abort if done
16 echo on
17 pause
18 submit backup

This file, which I call FILEBAK.SUB, is created with VDE or WordStar in ASCII or non-document mode. You don't enter the line numbers, of course.

When you start this backup routine you'll enter the following on the command line:

SUBMIT FILEBAK YYMMDD<cr>

The YYMMDD represents the year, month, and day the backup was made. More about this later.

Line 01 turns the echo off so that you don't see the commands on the next few lines, just the prompts. Lines 02 through 04 are prompts to remind the user that the backup disk has to be in the drive and that the date is needed on the command line. Line 05 then turns the echo back on. We could keep it off, but it's nice to see that what's supposed to be happening is happening. I copy my files to a rotating set of backup disks so I couldn't test to see if they got there as you could if you used a new disk each time.

Line 06 runs the submit utility PAUSE.COM which prompts the user and then stops processing of a SUB file until the user presses a key. Pressing A aborts the SUB file processing; any other key allows it to continue. Line 06 is a pause so that the user can easily abort if the date has been forgotten.

Lines 07 through 10 erase the existing empty file backup dates on the source drive, save a new empty file backup date on the source drive, and then do the same on the destination drive. These date files take up no disk space, just a directory entry. The result is a file named /FYYMMDD.UPD on both disks. You may want to substitute a hyphen for the slash, the idea simply being to get it to sort to the top of any alphabetical directory. I put the letter F in the filename to indicate which database was backed up on the date indicated. The letters "UPD" stand for "update".

Lines 11 and 12 copy the data and index files from my database to the backup disk. I use PC-File 80, which creates three files, data, index, and header. The header file doesn't change in ordinary usage, so there's no need to copy it. The "GO" command (Line 12) is a ZCPR resident command, which runs the previous program if it is still in memory after running (and PIP, like most, is). If you're not running ZCPR (any version) you can achieve the same result on most CP/M 2.2 machines by saving an empty file called GO.COM (Save 0 GO.COM<cr>).

At Line 13 we turn the echo off again, and Lines 14 and 15 prompt the user to insert another disk and remind the user to press A to abort when the requisite number of backup disks have been made. If you always make two backups you could simply repeat the commands once in the FILEBAK.SUB file.

Line 16 turns echo back on, Line 17 makes a pause, and Line 18 repeats the backup procedure if the user has not aborted.

I normally back up certain databases to specific floppies, so I put the submit file on the floppy disk and save space on my RAM disk where each file requires 4K bytes.

Mike Andrews demonstrated years ago how this task could be done with SYNONYM.COM and /.COM to create a command file that would do essentially the same thing, though limitations of the CP/M command line would not allow the pauses and repeats. (The command line used to create the freestanding COM file cannot exceed 128 characters.) I like this verbose procedure through SUBMIT because of the reminders to enter the date on the command line and the ability to repeat without having to enter the date a second time (I make three backups every time!).

ZCPR2 and ZCPR3 users can use aliases instead of SUB files, of course, or ZFILER scripts. The advantage of SUB files and aliases over the SYNONYM.COM and /.COM combination is that you can easily edit the former. NEWBATCH.COM can accomplish the same results on most CP/M systems by creating a free-standing COM file that can be edited. Because you can put multiple lines in the NEWBATCH file you can get around the CP/M command line limit of 128 bytes, too.

More could be done to this: for example, using Roy Lipscomb's SUPERMIT series you could, instead of looping by running SUBMIT and FILEBAK.SUB again, you could GOTO line line 09 and skip the reminder to put the date on the commnnd line and the pause to abort if you forgot.