CROSSREF Manual

EXTENDED BASIC
Sample Listing
100 ! Print monthly account activity summary.
200 ! Set up function to find current month's stuff.
210 currentmo$ = MID$(DAT$,4,3)
220 DEF fnthismonth(tdate$)
230 IF MID$(tdate$,4,3)=currentmo$ &
THEN fnthismonth=1 ELSE fnthismonth=0
240 FNEND
300 ! Set up map and open account file.
310 MAP (accounts) id$=6, lname$=20, firname$=20, &
FILL$=60, balance, lasttrandate$=8
320 OPEN "accounts" as #1, ORGANIZATION INDEXED, &
MAP accounts, &
ACCESS READ, ALLOW READ
400 ! Print header for report.
410 PRINT USING 710 \ PRINT USING 720 \ PRINT USING 730
500 ! Read records and print lines of report.
510 ON ERROR GOTO 900
520 WHILE ERR = 0
530 GET #1
540 IF (fnthismonth(lasttrandate$)) &
THEN PRINT USING 740, id$, &
TRM$(lname$) + ", " + firname$, &
balance, lasttrandate$ \&
total = total + balance
550 NEXT
600 ! Print total.
610 PRINT \ PRINT USING 750
620 PRINT USING 760, total \ PRINT
700 ! All the print formats are kept here.
710 : ACCOUNT CURRENT TRANSACTION
720 : NUMBER NAME BALANCE DATE
730 : ----------------------------------------------------
740 : 'RRRRR | 'LLLLLLLLLL | $$##,###.##- | 'LLLLLLL
750 : ____________
760 : TOTAL IS: $$#,###,###.##-
900 ! Error processing code.
910 IF ERR=1 AND ERL=530 THEN RESUME 600 &
ELSE ON ERROR GOTO 0
Figure 8-1. EXTENDED BASIC Sample Program
8-4