Keeps a running checking-account balance from records stored in the program’s own DATA lines. Each record holds a date, a type code, an amount and a remark. At the prompt you enter part of a date to list matching entries, such as the first characters of a month, a full date to pull a single entry, or just ENTER for everything; the program prints each matching record with its effect on the balance, then a “TOTAL USABLE BALANCE” that flashes in red if it is zero or below. Everything shown on screen is also sent to the printer.
The title screen reads “CHECKING BALANCE” preceded by its owner’s first name, and the program saves itself as checkbal or ck; “SuperCheck” is the name in the tape header. A reminder screen lists the codes: BAL, CHG and V/d go in the type field, MONTH in the date field and VOID in the remark.
Program Analysis
Program Structure
- Lines 100–410: colours, two 100-element arrays and the title and code reminder, sent to the printer as well.
- Lines 500–525: the search prompt and column headings.
- Lines 600–740: the main loop, which reads a record, adjusts its amount by type and prints it if the search string occurs anywhere in its date.
- Lines 800–850: the total.
- Lines 1000–8998: the records, ended by a record whose date is
"z". - Line 9999: saves the program with
LINE 0, verifies it and reruns.
How amounts are counted
Line 611 turns every amount into a debit and takes off 30 cents more, apparently a per-check charge. Lines 612–617 then correct this by type: a BAL (balance brought forward) or V/d entry becomes a credit at face value, a CHG (bank charge) is debited without the extra 30 cents, a V/w entry carries a 15-cent charge instead, and a VOID remark refunds the 30 cents. A MONTH record sets its own amount to zero and restarts the running total, and the total is rounded to cents at line 731.
Notable Techniques
- The search is a substring match over the date field (
a$(s TO s+x-1)), so an empty search string matches every record. - Typing the
STOPkeyword at the prompt ends the program (line 504). POKE 23692,255before each record keeps the screen from stopping with “scroll?” during a long listing.
Potential Issues
- After the total, the program runs straight on into line 999
SAVE "checkbal", so every report ends with a request to save the program. GO TO 700at line 650 targets a line that doesn’t exist; it lands on line 710, which works.- Only
c(1)is ever used, sincecstays 1 (LET c=cat line 730 does nothing), and the arrayb()is never used. - The printed column heading says “DUE:” where the screen says “CHECK:”.
- New records have to be typed in as
DATAlines, and the program’s ownDATAholds the last owner’s entries.
Source Code
100 INK 0: PAPER 6: BORDER 6
300 DIM b(100): DIM c(100)
400 CLS : PRINT TAB 3;"DON'S CHECKING BALANCE"
405 LPRINT TAB 3;"DON'S CHECKING BALANCE"
406 PRINT AT 10,5;"REMEMBER: BAL-->B$"
407 PRINT " CHG-->B$"
408 PRINT " V/d-->B$"
409 PRINT " MONTH>A$"
410 PRINT " VOID->C$"
500 PRINT AT 3,0;"STATUS? Just use the first digit for the month desired... Or the full date for individual search/pull... ENTER for all...": INPUT n$: CLS : LPRINT "SEARCHING FOR: ";n$: PRINT "SEARCHING FOR: ";n$
504 IF n$=" STOP " THEN STOP
505 LPRINT : LPRINT "STATUS? Press ENTER to continue": LPRINT n$
510 PRINT : PRINT "DATE: CHECK: PAID: REM:"
515 LPRINT : LPRINT "DATE: DUE: PAID: REM:"
520 PRINT "--------------------------------"
525 LPRINT "--------------------------------"
600 LET x=LEN n$: LET ct=0: LET c=1
610 READ a$,b$,c(c),c$: LET y=LEN a$
611 LET c(c)=-c(c)-.30
612 IF b$="V/d" THEN LET c(c)=-c(c)-.30
613 IF b$="BAL" THEN LET c(c)=-c(c)-.30
614 IF b$="CHG" THEN LET c(c)=c(c)+.30
615 IF a$="MONTH" THEN LET c(c)=0: LET c=1
616 IF b$="V/w" THEN LET c(c)=c(c)+.15
617 IF c$="VOID" THEN LET c(c)=c(c)+.30
618 POKE 23692,255
620 IF a$="z" THEN GO TO 800
640 FOR s=1 TO y-x+1
650 IF n$=a$(s TO s+x-1) THEN GO TO 700
660 NEXT s
670 GO TO 610
710 PRINT a$;TAB 10;b$;TAB 14;c(c);TAB 22;c$
720 LPRINT a$;TAB 10;b$;TAB 14;c(c);TAB 22;c$
730 LET ct=ct+c(c): LET c=c
731 LET ct=INT (ct*100+.5)/100
735 IF a$="MONTH" THEN LET ct=0: LET c=1
740 GO TO 610
800 PRINT "================================"
810 LPRINT "================================"
815 IF ct<=0 THEN PRINT "TOTAL USABLE BALANCE: "; FLASH 1; PAPER 6; INK 2;TAB 22;"$";ct: GO TO 830
820 PRINT "TOTAL USABLE BALANCE:";TAB 22;"$";ct
830 LPRINT "TOTAL USABLE BALANCE:";TAB 22;"$";ct
840 PRINT "================================"
850 LPRINT "================================"
999 SAVE "checkbal"
1000 DATA "JUL/85","BAL",36.21,"BAL FWD"
1001 DATA "JUL 01/85","CHG",3,"BANK CHG"
1002 DATA "JUL 01/85","A/d",13.35,"LIFE INS"
8998 DATA "z","1",1,"Z"
8999 STOP
9999 SAVE "@1,ck" LINE 0: CLS : PRINT AT 10,6;"VERIFYING ""ck""": VERIFY "@ck": PRINT AT 10,6;" ""@ck""VERIFIED": BEEP .1,.05: BEEP .1,.15: BEEP .1,.05: BEEP .1,.15: BEEP .1,.05: BEEP .1,.15: PAUSE 400: RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
