rem - program INSTALL.BAS
rem - Perch I Installation routine
rem - Copyright Peter C. Hawxhurst 1982
rem - revised 05/25/1982
rem - variable tabulation ************************
rem   a$  = account title input
rem   b$  = account balance input
rem   cca1$ to cca6$ = credit card acct titles
rem   ccb1  to ccb6  = credit card acct balances
rem   csa1$ to csa3$ = chk'g/saving acct titles
rem   csb1  to csb3  = chk'g/saving acct balances
rem   i%  = for next loop counter
rem   j   = input counter high end
rem   j%  = for next loop counter
rem   q2  = account correction number
rem   q$  = return to continue
rem   q1$ = data verification question
rem   q2$ = account correction number input
rem   q4$ = title or balance correction
rem   s1  = end switch
rem   s2  = first pass switch
rem   s3  = error switch
rem   x   = numeric check variable
rem   xpos% = cursor x axis for correction
rem   y   = decimal point locator
rem   ypos% = cursor y axis for correction
rem   z   = numericcheck variable
rem - program structure **************************
gosub 100 : rem - housekeeping
10 if s1=1 then 90
gosub 200 : rem - process
goto 10
90 gosub 300 : rem - end of job
%chain 100,9000,500,500
chain "A:PERCH"
100 rem - housekeeping subroutine ****************
dim csa1(12),csa2(12),csa3(12)
dim cca1(12),cca2(12),cca3(12)
dim cca4(12),cca5(12),cca6(12)
let s2=1
create "B:SDF.DAT" as 1
create "B:CSF.DAT" as 2
create "B:CCF.DAT" as 3
create "B:LPF.DAT" as 4
close 2
close 3
close 4
return
200 rem - process subroutine *********************
if s2=1 then 210
gosub 500 : rem - cc screen
goto 220
210 gosub 400 : rem - c/s screen
220 gosub 600 : rem - input
let s2=0
return
300 rem - end of job subroutine ******************
print #1;csa1$,csb1,csa2$,csb2,csa3$,csb3
print #1;cca1$,ccb1,cca2$,ccb2,cca3$,ccb3
print #1;cca4$,ccb4,cca5$,ccb5,cca6$,ccb6
close 1
return
400 rem - c/s screen subroutine ******************
print chr$(26)
print chr$(27)+")";
print tab(16);"PERCH I INSTALLATION ROUTINE"
print
print tab(10);"CHECKING/SAVINGS ACCOUNT INFORMATION"
print
print tab(15);"Account  1";
print tab(28);"Account  2";
print tab(41);"Account  3"
print
print tab(2);"Title:"
print
print tab(2);"Balance:"
for i%=1 to 7
print
next i%
print tab(1);" ";
for i%=1 to 49
print "-";
next i%
print
print chr$(27)+"(";
return
500 rem - cc screen subroutine *******************
print chr$(26)
print chr$(27)+")";
print tab(16);"PERCH I INSTALLATION ROUTINE"
print
print TAB(12);"CREDIT CARD  ACCOUNT INFORMATION"
print
print tab(15);"Account  1";
print tab(28);"Account  2";
print tab(41);"Account  3"
print
print tab(2);"Title:"
print
print tab(2);"Balance:"
print
print tab(15);"Account  4";
print tab(28);"Account  5";
print tab(41);"Account  6"
print
print tab(2);"Title:"
print
print tab(2);"Balance:"
print
print tab(1);" ";
for i%=1 to 49
print "-";
next i%
print
print chr$(27)+"(";
return
600 rem - input subroutine ***********************
if s2=1 then 610
let j=6
goto 620
610 let j=3
620 for i%=1 to j
let xpos%=33+(13*i%)
gosub 700 : rem - account
if i%>3 then 630
print chr$(27)+"="+chr$(39)+chr$(xpos%);
print a$
goto 640
630 print chr$(27)+"="+chr$(45)+chr$(xpos%-39);
print a$
640 gosub 800
if i%>3 then 650
print chr$(27)+"="+chr$(41)+chr$(xpos%);
print b$
goto 660
650 print chr$(27)+"="+chr$(47)+chr$(xpos%-39);
print b$
660 next i%
670 gosub 900 : rem - cursor
input "Is all of above data correct (y/n) >";q1$
let q1$=ucase$(q1$)
if q1$<>"Y" and q1$<>"N" then 670
if q1$="Y" then 680
gosub 1000 : rem - correct
goto 670
680 if s2=1 then 690
let s1=1
690 return
700 rem - account subroutine *********************
710 gosub 900 : rem - cursor
print "Account";i%;" - ";
input "Enter account title >";a$
let a$=ucase$(a$)
if len(a$)<=12 then 720
gosub 900 : rem - cursor
print chr$(27)+")";
print "Error - name too long (12 characters max)!!!"
print tab(1);" ";
input "Press - RETURN - to retry >";line q$
print chr$(27)+"(";
goto 710
720 if s2=0 then 730
on i% goto 721,722,723
721 let csa1$=a$
goto 790
722 let csa2$=a$
goto 790
723 let csa3$=a$
goto 790
730 on i% goto 731,732,733,734,735,736
731 let cca1$=a$
goto 790
732 let cca2$=a$
goto 790
733 let cca3$=a$
goto 790
734 let cca4$=a$
goto 790
735 let cca5$=a$
goto 790
736 let cca6$=a$
790 return
800 rem - balance subroutine *********************
810 gosub 900 : rem - cursor
print "Account";i%;" - ";
input "Enter account balance >";b$
let x$=b$
gosub 1200 : rem - numeric check
if s3=0 then 820
goto 810
820 if s2=0 then 830
on i% goto 821,822,823
821 let csb1=val(b$)
goto 890
822 let csb2=val(b$)
goto 890
823 let csb3=val(b$)
goto 890
830 on i% goto 831,832,833,834,835,836
831 let ccb1=val(b$)
goto 890
832 let ccb2=val(b$)
goto 890
833 let ccb3=val(b$)
goto 890
834 let ccb4=val(b$)
goto 890
835 let ccb5=val(b$)
goto 890
836 let ccb6=val(b$)
890 return
900 rem - cursor subroutine **********************
print chr$(27)+"="+chr$(52)+chr$(33);
print chr$(27)+"R";
print chr$(27)+"="+chr$(53)+chr$(33);
print chr$(27)+"R";
print chr$(27)+"="+chr$(52)+chr$(33);
return
1000 rem - correct subroutine ********************
1010 gosub 900 : rem cursor
input "Enter account number for correction >";q2$
let x$=q2$
gosub 1200 : rem - numeric check
if s3=0 then 1020
goto 1010
1020 let q2=val(q2$)
if s2=0 then 1030
if q2<1 then 1010
if q2>3 then 1010
goto 1040
1030 if q2<1 then 1010
if q2>6 then 1010
1040 if q2<>int(q2) then 1010
let i%=q2
if q2>3 then 1050
let xpos%=33+13*q2
goto 1060
1050 let xpos%=33+13*(q2-3)
1060 gosub 900 : rem - cursor
input "Change (T)itle or (B)alance >";q4$
let q4$=ucase$(q4$)
if q4$<>"T" and q4$<>"B" then 1060
if q4$="B" then 1080
if q2>3 then 1070
let ypos%=39
goto 1100
1070 let ypos%=45
goto 1100
1080 if q2>3 then 1090
let ypos%=41
goto 1100
1090 let ypos%=47
1100 print chr$(27)+"="+chr$(ypos%)+chr$(xpos%);
for j% = 1 to 12
print " ";
next j%
print
if q4$="B" then 1110
gosub 700
goto 1120
1110 gosub 800
1120 print chr$(27)+"="+chr$(ypos%)+chr$(xpos%);
if q4$="B" then 1130
print a$
goto 1190
1130 print b$
1190 return
1200 rem - numeric check subroutine **************
if left$(x$,1)="-" then let x=len(x$)
if left$(x$,1)="-" then let x=x-1
if left$(x$,1)="-" then let x$=right$(x$,x)
let s3=0
let x=0
let y=0
let z=0
let y=y+match(".",x$,1)
for j%=1 to len(x$)
let z=z+j%
next j%
if y=0 then 1210
let z=z+1
1210 for j%=1 to len(x$)
let x=x+match("#",x$,j%)
next j%
if len(x$)<10 then 1220
gosub 900 : rem - cursor
print chr$(27)+")";
print "Error - number too large!!!"
print tab(1);" ";
input "Press - RETURN - to retry >";line q$
print chr$(27)+"(";
let s3=1
goto 1290
1220 if x=z then 1290
let s3=1
gosub 900 : rem - cursor
print chr$(27)+")";
print "Error - non numeric data!!!"
print tab(1);" ";
input "Press - RETURN - to retry >";line q$
print chr$(27)+"(";
1290 return 
