25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music

Quickly save or print lines from an overly large disk file, and discard the rest, Microsoft MBASIC, Heathkit H-89 computer

These are Heathkit H-89 Microsoft MBASIC programs to quickly select the lines you want to save from a disk file created by a modem program's capture buffer routine, and discard the rest.

Modem programs of the 1980's were text-based, and generally had a buffer-capture option that saved the entire text of your online session to disk.

A long session could create a disk file much larger than most text editing programs could edit.

This program allows you to page through one of these files, quickly discard all the menus and other junk, and end up with a file of manageable size.

FASTEDIT

This program allows you to scan quickly through an ASCII disk file and selectively transfer lines from that file (the source) into another file (the destination). The information saved can optionally be printed on a printer.

The program reads the source file in blocks of 20 lines each, and prints those 20 lines on your screen. You select which, if any, of those lines you want to save. If you want to save only one line, enter the number of that line for both the start and end #'s. If you want the program to move on to the next block of 20 lines, then enter '00' as the start line. Always enter line numbers as two digits. That is, line 9 should be entered as '09'.

Carriage returns are not necessary except while entering file names and the date.

Errors during input of the lines to save are somewhat rare, and even more rarely are they important. If you make a mistake on the first digit of the line number, press the backspace key instead of pressing the second digit; you can then re-enter the entire two-digit line number. If you err on the second digit of the line number, there is no way to recover the error. It is usually preferable just to continue input, leaving the error in, but if the file is very important, the program can be stopped by pressing ^C (Ctrl+C), and re-run from the beginning.

After editing, you have the option of killing the original file (the source), and of printing out the new file. After printing, you can also kill the new file, leaving only your hardcopy report remaining. This is the usual procedure. If you do not kill the source file, it will remain on the disk as 'fname.BAK'. If you do not kill the final file (the destination), it will remain on the disk as 'fname', the name of the source file before it was edited. If you abort execution before the program is finished, you may also find the temporary destination file, called 'SCRATCH.DAT' on the disk.

Sometimes, a file will be so large that the disk cannot contain both the source and destination files. In that case, use the program called PRINEDIT.BAS, which will print the selected lines directly to the printer without creating a destination file.

PRINEDIT

This program, which works the same as FASTEDIT, allows you to scan an ASCII file and print directly to a printer selected lines from that file.

This program should be used instead of FASTEDIT when the file to be edited is so large that the disk cannot contain both the source and destination disk files. PRINEDIT creates no interim disk file. All specified lines are printed directly to the printer.

After editing and printing, you have the option of deleting the source file.

FASTEDIT.BAS

10 REM PROGRAM NAME 'FASTEDIT'
20 REM COPYRIGHT (C)1982 STEVEN WHITNEY.  
21 'Initially published by http://25yearsofprogramming.com.
22 'Published under GNU GPL (General Public License) Version 3,with ABSOLUTELY NO WARRANTY.
30 PRINT CHR$(27)"E" : REM clear terminal screen
40 ON ERROR GOTO 600
50 DIM T$(20)
60 PRINT "This program is for fast line-editing of a file containing dialogue between":PRINT"a host computer and modem-connected terminal (or line editing":PRINT "of any other files)." :PRINT
70 PRINT "It allows you quickly to save and optionally to print out wanted lines":PRINT "and to discard the rest."
80 PRINT:PRINT "The program uses two data files: One is your original.  The second is called":PRINT "'SCRATCH.DAT'.  If you make a mistake in editing, abort program execution,":PRINT "close both open files, and restart the edit.":PRINT
90 PRINT "If you kill none of the files, then after editing you will be left":PRINT "with two files.  The file with the '.BAK' extension is the original file.":PRINT"The file with the same name as the original is the new, edited version.":PRINT
100 PRINT "Use no carriage returns, except when entering file names and date."
110 PRINT STRING$(75,"=")
120 PRINT "IF NOT ALREADY DONE, PLEASE DEPRESS THE 'CAPS LOCK' KEY ON YOUR KEYBOARD.":PRINT "ALL YOUR RESPONSES MUST BE IN CAPITAL LETTERS."
130 PRINT STRING$(75,"=")
140 PRINT:PRINT "Do you just want to print a file without editing?(Y/N)";:Z$=INPUT$(1):PRINT Z$
150 IF Z$<>"Y" AND Z$<>"N" THEN 140
160 IF Z$="Y" THEN P1$="print" ELSE P1$="edit"
170 PRINT:PRINT "What file to ";P1$;
180 INPUT " (including extension, if any)";A$
190 PRINT STRING$(75,"=")
200 IF Z$="Y" THEN INPUT "What date should I put on the printout (any format ok)";DATE$: GOTO 470
210 OPEN "I",1,A$
220 OPEN "O",2,"SCRATCH.DAT"
230 IF EOF(1) THEN PRINT "END OF FILE" : CLOSE:GOTO 370
240 FOR I=1 TO 20
250 LINE INPUT #1,T$(I)
260 PRINT I;".  ";T$(I)
270 NEXT I
280 PRINT "(Two digits always) START saving at line # ('00' for new page)";:X$=INPUT$(2):PRINT X$:A=VAL(X$):IF A<0 OR A>20 THEN PRINT CHR$(7):GOTO 280
290 IF RIGHT$(X$,1)=CHR$(8) OR RIGHT$(X$,1)=CHR$(127) THEN 280
300 IF A=0 THEN 230
310 PRINT "(Two digits always) STOP saving at line # (Same # if only one line)";:X$=INPUT$(2):PRINT X$:B=VAL(X$): IF B<A OR B<1 OR B>20 THEN 310
320 IF RIGHT$(X$,1)=CHR$(8) OR RIGHT$(X$,1)=CHR$(127) THEN 310
330 FOR I=A TO B
340 PRINT #2,T$(I)
350 NEXT I
360 GOTO 280
370 PRINT STRING$(75,"="):PRINT:PRINT "Kill the original file (Y/N)?";:K$=INPUT$(1):PRINT K$
380 IF K$<>"Y" AND K$<>"N" THEN 370
390 IF K$="Y" THEN KILL A$ 
400 TN$=RIGHT$(A$,4):IF LEFT$(TN$,1)="." THEN TN$=LEFT$(A$,LEN(A$)-4) ELSE TN$=A$
410 IF K$="N" THEN NAME A$ AS TN$+".BAK" 
420 NAME "SCRATCH.DAT" AS A$
430 PRINT:PRINT "Print out the saved material (Y/N)?";:Z$=INPUT$(1):PRINT Z$
440 IF K$<>"Y" AND K$<>"N" THEN 430
450 IF Z$="N" THEN END
460 PRINT:INPUT "What date should I use on the printout (any format ok)";DATE$
470 LPRINT CHR$(15) : WIDTH LPRINT 132
480 OPEN "I",1,A$
490 LPRINT A$,DATE$:LPRINT
500 WHILE NOT(EOF(1))
510 LINE INPUT #1, T$
520 LPRINT T$
530 WEND
540 CLOSE
550 PRINT
560 PRINT "Kill the file just printed? (Y/N)";:Z$=INPUT$(1):PRINT Z$
570 IF K$<>"Y" AND K$<>"N" THEN 560
580 IF Z$="Y" THEN KILL A$
590 END
600 IF ERR=62 AND ERL=250 THEN RESUME 280
610 IF ERR=53 AND (ERL=210 OR ERL=480) THEN PRINT:PRINT "Only these files are available:":PRINT:FILES : PRINT STRING$(75,"-"):RESUME 170
620 PRINT "PLEASE CONSULT YOUR BASIC-80 MANUAL REGARDING THE FOLLOWING ERROR MESSAGE.":PRINT "THE ERROR OCCURRED AT PROGRAM LINE NUMBER";ERL
630 ON ERROR GOTO 0
640 REM COPYRIGHT (C)1982 STEVEN WHITNEY.  

PRINEDIT.BAS

10 REM PROGRAM NAME 'PRINEDIT'
20 REM COPYRIGHT (C)1982 STEVEN WHITNEY.  
21 'Initially published by http://25yearsofprogramming.com.
22 'Published under GNU GPL (General Public License) Version 3,with ABSOLUTELY NO WARRANTY.
30 PRINT CHR$(27)"E"
40 ON ERROR GOTO 520
50 DIM T$(20)
60 PRINT "This program is virtually identical to FASTEDIT, except that this one does":PRINT "not store information in a temporary file.  It prints the chosen lines directly":PRINT "to the line printer.  It is for editing files that are so large that to"
70 PRINT "write the information to a scratch file might cause 'disk full' errors!"
80 PRINT "It allows you to print out wanted lines and to discard the rest."
90 PRINT:PRINT "If you make a mistake in editing, abort program execution,":PRINT "close the open file, and restart the edit.":PRINT
100 PRINT "Use no carriage returns, except when entering file names and date."
110 PRINT STRING$(75,"=")
120 PRINT "IF NOT ALREADY DONE, PLEASE DEPRESS THE 'CAPS LOCK' KEY ON YOUR KEYBOARD. ":PRINT "ALL YOUR RESPONSES MUST BE IN UPPER CASE.":PRINT STRING$(75,"=")
130 PRINT:INPUT "What DATE should I use on the printout (any format ok)";DATE$
140 PRINT:PRINT "Do you just want to print a file without editing?(Y/N)";:Z$=INPUT$(1):PRINT Z$
150 IF Z$<>"Y" AND Z$<>"N" THEN 140
160 IF Z$="Y" THEN P1$="print" ELSE P1$="edit and print"
170 PRINT:PRINT "What file to ";P1$;
180 INPUT " (including extension, if any)";A$
190 PRINT STRING$(75,"=")
200 IF Z$="Y" THEN 430
210 OPEN "I",1,A$
220 LPRINT CHR$(15):WIDTH LPRINT 132
230 LPRINT A$,DATE$:LPRINT
240 IF EOF(1) THEN PRINT "END OF FILE" : CLOSE:GOTO 380
250 FOR I=1 TO 20
260 LINE INPUT #1,T$(I)
270 PRINT I;".  ";T$(I)
280 NEXT I
290 PRINT "(Two digits always) Start saving at line # ('00' for new page)";:X$=INPUT$(2):PRINT X$:A=VAL(X$):IF A<0 OR A>20 THEN 290
300 IF RIGHT$(X$,1)=CHR$(8) OR RIGHT$(X$,1)=CHR$(127) THEN 290
310 IF A=0 THEN 240
320 PRINT "(Two digits always) Last line # to save (Same # if only one line)";:X$=INPUT$(2):PRINT X$:B=VAL(X$): IF B<A OR B<1 OR B>20 THEN 320
330 IF RIGHT$(X$,1)=CHR$(8) OR RIGHT$(X$,1)=CHR$(127) THEN 320
340 FOR I=A TO B
350 LPRINT T$(I)
360 NEXT I
370 GOTO 290
380 PRINT STRING$(75,"="):PRINT:PRINT "Kill the file that is on the disk? (Y/N)";:K$=INPUT$(1):PRINT K$
390 IF K$<>"Y" AND K$<>"N" THEN 380
400 PRINT
410 IF K$="Y" THEN KILL A$
420 END
430 LPRINT CHR$(15) : WIDTH LPRINT 132
440 OPEN "I",1,A$
450 LPRINT A$,DATE$:LPRINT
460 WHILE NOT(EOF(1))
470 LINE INPUT #1, T$
480 LPRINT T$
490 WEND
500 CLOSE
510 GOTO 380
520 IF ERR=62 AND ERL=260 THEN RESUME 290
530 IF ERR=53 AND (ERL=210 OR ERL=440) THEN PRINT:PRINT "Only these files are available:":PRINT:FILES : PRINT STRING$(75,"-"):RESUME 170
540 PRINT "AN ERROR WAS ENCOUNTERED.  PLEASE CONSULT YOUR BASIC-80 MANUAL REGARDING THE":PRINT "FOLLOWING ERROR MESSAGE.  THE ERROR OCCURRED AT PROGRAM LINE #";ERL
550 ON ERROR GOTO 0
560 REM COPYRIGHT (C)1982 STEVEN WHITNEY.  

 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.