The program

! Practice Program 10-1

! Read accounts payable information from a file

! and print payment checks for vendors.

! Use OPTION NOLET to shorten format string lines.

! demonstrates PRINT USING format$: item1, item2, ...

 

! Format strings for check form.

DIM L$(1 to 11) !lines containing check information

!OPTION NOLET

LET L$(1) = "+-----------------------------------------------------------+"

LET L$(2) = "| ACME SALES CORPORATION >################## |"

LET L$(3) = "| Detroit, Michigan |"

LET L$(4) = "| |"

LET L$(5) = "| Pay to: <################################ $$$$$$$.## |"

LET L$(6) = "| |"

LET L$(7) = "| |"

LET L$(8) = "| |"

LET L$(9) = "| No: %%%% ________________________________ |"

LET L$(10)= "| Treas. |"

LET L$(11)= "+-----------------------------------------------------------+"

 

! Direct output to printer.

! To test program, assign zero to N and comment out the OPEN statement,

! thus directing output to the screen.

LET n=0 !prints to screen

!LET N = 10

!OPEN #N: printer !uses printer

 

! Read information and start printing checks.

LINE INPUT prompt "Date on checks? ": CheckDate$

INPUT prompt "Number of first check? ": CheckNum

! Use file ACCOUNTS.DAT for testing.

LINE INPUT prompt "Name of accounts file? ": FileName$

OPEN #1: name FileName$

LET Count = 0

FOR I = 1 to 3 ! print three blank lines

PRINT #N

NEXT I

DO until End #1

LINE INPUT #1: Name$

LINE INPUT #1: Amount$

LET Count = Count + 1

PRINT #N: L$(1)

PRINT #N, using L$(2): CheckDate$

PRINT #N: L$(3)

PRINT #N: L$(4)

PRINT #N, using L$(5): Name$, Val(Amount$)

PRINT #N: L$(6)

PRINT #N: L$(7)

PRINT #N: L$(8)

PRINT #N, using L$(9): CheckNum

LET CheckNum = CheckNum + 1

PRINT #N: L$(10)

PRINT #N: L$(11)

FOR I = 1 to 3

PRINT #N:

NEXT I

 

! This routine adjusts spacing for 3 checks per page.

! Page adjustment may be different on your printer.

IF Mod(Count, 3) = 0 then

FOR I = 1 to 2

PRINT #N

NEXT I

PAUSE 1

END IF

PAUSE 1

LOOP

!CLOSE #N ! this statement is sometimes needed to activate a printer,

! but should be commented out when printing to the screen

END

The output

Checks are printed to the screen