1 '	ELECTRONIC CARD FILE
2 ' BY Joe Wiellette
3 ' Permission is granted to use, but not to sell,
4 ' these programs.
50 DEFINT S,L,K,I,J,K,T,Q
100 '    ********   REPT-FRM   ********
110 '
120 '
130 CH=0:N=1
140 CLOSE
200 PRINT CLSCR$
220 PRINT"1) Create LABEL form
222 PRINT"2) *** Create REPORT form
224 PRINT"3) Return to MENU
230 PRINT"Which ",
240 DEFAULT$="2":ALLOWED$="123":GOSUB 5000:

	IF ALLOWED=0 THEN 200
260 IF Q=1 THEN GOSUB 2000 
270 IF Q=2 THEN GOSUB 1000
272 IF Q=3 THEN 300
302 CLOSE
310 RUN"MENU
1000 '
1010 '   *********   CREATE REPORT FORM  ********
1012 PRINT CLSCR;
1020 '
1120 INPUT"Enter the file name for this report form ";REPORT$
1140 REPORT$=DRIVE$+REPORT$
1160 OPEN"O",#3,REPORT$
1170 GOSUB 4000:'   *** PRINT FIELDS ***
1180 WHILE N<>0:'  *****  GET FIELDS  *****
1200    CH=CH+1
1220    PRINT"Enter field # for choice #"CH;
1240    INPUT N
1250    PRINT#3,N
1260 WEND
1300 '
1310 '   *****   NUMBERING/RECORD #'S/LIMITS  ******
1330 '
1350 PRINT"Do you want list numbering (*** YES) ";
1360 DEFAULT$="Y":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1350
1370 PRINT#3,Q$
1380 IF Q$="Y" THEN 1450
1390 PRINT"Do you want record #'s printed (**YES) ";
1400 DEFAULT$="Y":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1390
1410 PRINT#3,Q$
1450 PRINT"Do you wish to set limits (** NO) ";
1460 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1450
1470 PRINT#3,Q$
1480 IF Q$<>"Y" THEN 1600
1490 GOSUB 4000
1500 PRINT:INPUT"Enter field to limit ",N
1510 PRINT#3,N
1520 PRINT"1)** Equal 2) Low limit 3) High limit ";
1530 DEFAULT$="1":ALLOWED$="123":GOSUB 5000:

	IF ALLOWED=0 THEN 1520:L4=Q
1550 PRINT#3,Q
1600 '
1610 ' *****   SORT CHECK  ******
1620 '
1650 PRINT"Do you want a sort key (** NO) ";
1660 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1650
1670 PRINT#3,Q$
1680 IF Q$<>"Y" THEN 1750
1690 INPUT"Enter name of sort key file ";SORT$
1700 PRINT#3,SORT$
1750 '
1760 '    *******  CALCULATIONS AND TOTALS  *****
1770 '
1800 PRINT"Calculate within records (** NO) ";
1810 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1800
1820 PRINT#3,Q$
1830 IF Q$<>"Y" THEN 1900
1840 PRINT:INPUT"Enter first field for calculation ",N
1850 PRINT#3,N
1860 PRINT:INPUT"Enter second field for calculation ",N
1870 PRINT#3,N
1880 PRINT"1)** Add 2) Subtract 3) Multiply
1882 PRINT"4) Divide (first by/from second) ";
1884 DEFAULT$="1":ALLOWED$="1234":GOSUB 5000:

	IF ALLOWED=0 THEN 1880
1890 PRINT#3,Q
1900 PRINT"Total any fields (*** NO) ";
1910 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 1900
1920 PRINT#3,Q$
1930 IF Q$<>"Y" THEN 1990
1940 PRINT:INPUT"Enter field to be totaled (0 to end) ",N
1960 PRINT#3,N
1962 IF N=0 THEN 1990
1970 GOTO 1940
1990 RETURN
2000 '
2010 '    *********   CREATE LABEL FORM  ********
2020 '
2030 PRINT CLSCR$
2100 INPUT"Enter file name for Label form ";REPORT$
2110 REPORT$=DRIVE$+REPORT$
2130 OPEN"O",#3,REPORT$
2132 PRINT#3,"Y"
2140 GOSUB 4000
2142 FIELDS=0
2150 FIELDCOUNT=0:LINENUM=1:LINES(1)=0:Q$="Y":R$="Y"
2200 WHILE R$="Y"
2220    WHILE Q$="Y"
2230            LINES(LINENUM)=LINES(LINENUM)+1
2240            FIELDCOUNT = FIELDCOUNT + 1
2260            PRINT"Enter field choice for line "LINENUM;
2270            WHILE FIELDS<100 : INPUT FIELDS :WEND
2280            PRINT#3,FIELDS
2290            FIELDS=0
2300		PRINT"Any more this line (**YES) ";
2320		DEFAULT$="Y":ALLOWED$="YyNn":

			GOSUB 5000:IF ALLOWED=0 

			THEN 2300
2322            PRINT#3,Q$
2340    WEND :'  *** END OF Q LOOP FOR ONE LINE ***
2360 PRINT"Any more lines (** YES) ";
2670 DEFAULT$="Y":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 2360
2671 R$=Q$:Q$="Y"
2672 PRINT#3,R$
2680 LINENUM=LINENUM + 1
2690 LINES(LINUM)=0
2700 WEND :'   ****  LAST LINE OF LABEL  *****
2750 '
2760 '  *****  CHECK FOR LIMITS  ******
2770 '
2800 PRINT CLSCR$
2810 PRINT"Do you wish to set limits (*** NO) ";
2820 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 2810
2830 PRINT#3,Q$
2840 IF Q$<>"Y" THEN 3000
2860 INPUT"Enter field to limit ",FIELDS
2870 PRINT#3,FIELDS
2880 PRINT"1) ** Equal 2) Low limit 3) High limit ":
2882 DEFAULT$="1":ALLOWED$="123":GOSUB 5000:

	IF ALLOWED=0 THEN 2880:L4=Q
2890 PRINT#3,Q
3000 '
3010 '  ******  CHECK FOR SORT  ******
3020 '
3100 PRINT"Use a sort key file (*** NO) ";
3110 DEFAULT$="N":ALLOWED$="YyNn":GOSUB 5000:

	IF ALLOWED=0 THEN 3100
3120 PRINT#3,Q$
3130 IF Q$<>"Y" THEN 3400
3150 INPUT"Enter name of sort key file ",SORT$
3160 PRINT#3,SORT$
3400 CLOSE(3)
3420 RETURN
4000 '
4010 '    ********  DISPLAY HEADER LISTINGS *******
4020 '
4030 PRINT CLSCR$
4040 FOR I=1 TO A(2)
4050    FOR J=1 TO F(I)
4060            FIELDS=(I*100)+J
4070            PRINT FIELDS"   "LABEL$(I,J)
4080    NEXT J
4090 NEXT I
4100 RETURN
5000 '
5010 '		******  INPUT  ********
5020 '
5030 PRINT BELL$;
5040 ALLOWED=0
5050 Q$=INPUT$(1)
5060 PRINT Q$
5070 IF Q$=CHR$(13) THEN Q$=DEFAULT$
5080 Q=VAL(Q$)
5090 FOR L=1 TO LEN(ALLOWED$)
5100 IF MID$(ALLOWED$,L,1)=Q$ THEN ALLOWED=1
5110 NEXT L
5120 RETURN
5130 '
5140 '
AL(Q$)
5090 FOR L=1 TO LEN(ALLOWED$)
5100 IF MID$(ALLOWED$