5 PRINT TAB(40);:PRINT "Press <Enter> to continue.";:IN$=INKEY$:WHILE INKEY$<>CHR$(13):WEND:LOCATE,40:PRINT SPACE$(26):RETURN
6 PRINT TAB(14);:PRINT "Press <Enter> to continue, or `/' to end viewing.";:IN$=INKEY$:WHILE IN$<>CHR$(13) AND IN$<>"/":IN$=INKEY$:WEND:LOCATE,14:PRINT SPACE$(50):IF IN$="/" THEN I=N:RETURN ELSE RETURN
7 '<UNK! {000A}>*** Redirect to Block ***
9 ON QB GOTO 30,400,421 :STOP 'quit, restart, show file details again.<UNK! {000A}><UNK! {000A}>--- Another go? ---
10 DO$="run this program again now":GOSUB 20:IF Z$="Y" THEN 2 ELSE 30
19 '<UNK! {000A}>--- Yes/No? ---
20 PRINT:PRINT"Do you want to "+DO$;
21 INPUT" (Y/N)";Z$:IF Z$="" THEN Z$="N":RETURN ELSE Z$=CHR$(ASC(Z$) AND 95):IF Z$="Y" OR Z$="N" THEN RETURN ELSE PRINT"WHAT? ";:GOTO 21
29 '<UNK! {000A}>--- Errors & End ---
30 IF ERR THEN BEEP ELSE RUN "MENU"
31 IF ERR=70 THEN LINE INPUT"Can't write to that disk. Remove its Write-Protect tab, then press <Enter>.";Z$:RESUME
32 IF ERR=71 THEN LINE INPUT"That drive is empty or its gate is open. Fix, then press <Enter>.";Z$:RESUME
33 IF ERR=210 THEN RESUME 9 'from #86
39 ON ERROR GOTO 0:END'<UNK! {000A}><UNK! {000A}>--- Messages ---
40 BEEP:PRINT "---> Sorry, that entry is illegal.":RETURN
41 BEEP:PRINT "---> Sorry, double quotes are not allowed here.":RETURN
43 COLOR 23,0:PRINT:PRINT"Working";:COLOR 7,0:RETURN
44 LOCATE,1:PRINT"Ok, done.";:GOTO 5
49 '<UNK! {000A}>*** Vetted Decoding of FF X(I,J) from X$ ***<UNK! {000A}> Needs I, M, & Q(0)=1 from #96 or Q(0)=0 from #446.
50 K=1:L=M
51 KX=0:FOR J=K TO L:Y$=SPACE$(10):KY=0
52 KX=KX+1:IF KX>LEN(X$) THEN IF J=L THEN 54 ELSE 57
53 Z$=MID$(X$,KX,1):IF INSTR("-.0123456789",Z$) THEN KY=KY+1:MID$(Y$,KY,1)=Z$:GOTO 52 ELSE IF Z$<>" " THEN 58 ELSE IF KY=0 THEN 52
54 IF Q(0)=0 THEN L(J)=VAL(Y$) ELSE Q(J)=VAL(Y$)
55 NEXT J:IF KX>=LEN(X$) THEN 60
56 PLAY"L8O3CO2C":PRINT"Only the first"L"values have been read in that line. Re-do it";:GOSUB 21:IF Z$="Y" THEN 59 ELSE 60
57 PLAY"L32O4CEG>C":PRINT"Not enough values in the line above. Please re-do whole line.":GOTO 59
58 PLAY"L16O3CEL4>B":PRINT"That line contains a `non-numeric' entry. Please re-do whole line."
59 Q(0)=-9
60 RETURN
79 '<UNK! {000A}>*** Disk Input of X(I,J), N, M, etc ***<UNK! {000A}> Needs MNR, MNC.
80 IO$="I":GOSUB 110:CLS:PRINT "Loading data from disk.":INPUT #1,FL$,VR$
81 IF LEFT$(VR$,4)<>"(RL," THEN BEEP:PRINT "Unreadable file --- not made by our Data Filer/Editor program.":GOTO 86
83 IF UT<>0 THEN PRINT "This file is an upper triangular matrix, which this program can't use!":GOTO 86
84 PRINT"File has"N"rows of data. ";:IF N<MNR THEN PRINT "--- Not enough!":GOTO 86 ELSE IF N>MXR THEN PRINT"--- Too many!":GOTO 86
85 PRINT:PRINT"File has"M"column variables. ";:IF M<MNC THEN PRINT "--- Not enough!" ELSE IF M>MXC THEN PRINT"Too many!" ELSE 88
86 CLOSE:BEEP:GOSUB 5:ERROR 210
87 ' Select variables
88 PRINT:IF VN$="N" THEN PRINT "The"M"variables are not named.":GOTO 90
89 PRINT "Variables in file are:":FOR J=1 TO M:INPUT #1,VN$(J):PRINT J;VN$(J),:NEXT J:PRINT
90 IF M=MNC THEN 100 ELSE PRINT
91 PRINT"How many filed column variables are to be IGNORED (0-"MID$(STR$(M-MNC),2)")";:INPUT ND:IF ND<0 OR ND>M-MNC THEN 91 ELSE IF ND=0 THEN 100
94 IF ND=1 THEN PRINT "Number of the variable to be IGNORED (1-"MID$(STR$(M),2)")";:INPUT X$:Q(1)=VAL(X$):IF Q(1)<1 OR Q(1)>M THEN GOSUB 40:GOTO 94 ELSE 97
95 PRINT MID$(STR$(ND),2)" numbers of variables to be IGNORED (in ascending order & Free Format):":INPUT X$:IF VAL(X$)<1 THEN GOSUB 40:GOTO 95
96 Q(0)=1:MM=M:M=ND:GOSUB 50:Q(0)=0:M=MM
97 KK=1:L=1:FOR J=1 TO M:IF J=Q(KK) THEN KK=KK+1 ELSE VN$(L)=VN$(J):L=L+1
98 NEXT J
99 ' Now read numerical data from disk
100 COLOR 23,0:PRINT"Loading numbers";:COLOR 7,0:FOR I=1 TO N:KK=1:LL=1:L=M
101 FOR J=1 TO L:INPUT #1,Z
102 IF J=Q(KK) THEN KK=KK+1 ELSE X(I,LL)=Z:LL=LL+1
103 NEXT J:NEXT I:CLOSE:LOCATE,1:M=M-ND:RETURN
109 '<UNK! {000A}>--- Get Filespec ---
110 IF IO$="O" AND FL$>"" THEN PRINT "Will you file this data under the name "FL$;:GOSUB 21:IF Z$="Y" THEN 115
111 LINE INPUT "Filename (I will add .DAT extension)? ";FL$:IF FL$="" THEN 111 ELSE IF MID$(FL$,2,1)=":" THEN DR$=LEFT$(FL$,1):FL$=MID$(FL$,3)
112 ER=0:FOR I=1 TO LEN(FL$):Z$=MID$(FL$,I,1):IF INSTR(" .,/\|?*:;[]+="+CHR$(34),Z$) THEN ER=1
113 NEXT I
114 IF ER=0 AND FL$>"" AND LEN(FL$)<9 THEN FL$=FL$+".DAT" ELSE BEEP:PRINT "Invalid filename. Will you try again";:GOSUB 21:IF Z$="Y" THEN 111 ELSE 2
115 INPUT "Which drive (A,B,C,D)";DR$:IF DR$="" THEN 115
116 DR$=CHR$(ASC(DR$) AND 95):IF INSTR("ABCD",DR$)=0 THEN 115
117 INPUT "Which directory (e.g. WORK, MYDATA, or Null Entry if root) ";DR2$:IF DR2$="" THEN DR$=DR$+":" ELSE DR$=DR$+":\"+DR2$+"\"
129 '<UNK! {000A}>--- Open File, IO$= "I" or "O" ---
130 IF IO$="I" THEN 134 ELSE ON ERROR GOTO 132:OPEN DR$+FL$ FOR INPUT AS #1
131 CLOSE:DO$="<OVERWRITE> existing "+FL$:GOSUB 20:IF Z$="N" THEN 110 ELSE 133
132 RESUME 133 'OK to start new file, since FL$ not present.
133 ON ERROR GOTO 30:OPEN DR$+FL$ FOR OUTPUT AS #1:RETURN 'print #1,Q$A$Q$Q$B$Q$:close
134 ON ERROR GOTO 136:OPEN DR$+FL$ FOR INPUT AS #1 'for input
436 '<UNK! {000A}>--- Get label values L(J), J=1 to NG, & N(J)=# in Jth gp, C(J)=cum # of N(J)'s.
437 Z=0:J=1:L(J)=GP(0)\1000:N(J)=1:C(J)=0
438 FOR I=2 TO N
439 IF GP(I-1)\1000=GP(I-2)\1000 THEN N(J)=N(J)+1 ELSE C(J)=C(J-1)+N(J):IF J<MG THEN J=J+1:L(J)=GP(I-1)\1000:N(J)=1 ELSE I=N:Z=9
440 NEXT I:IF Z=0 THEN NG=J:C(J)=N:GOTO 443
441 PRINT"Variable #"LAB"contains more than"MG"(0-30) different group labels.":DO$="group persons by another variable":GOSUB 20:IF Z$="Y" THEN 428 ELSE 10
442 '<UNK! {000A}>--- Show ascending labels L(J), & seek a different sequence ---
443 PRINT"Variable #"LAB"has the following Group Labels:":FOR J=1 TO NG:PRINT L(J);:NEXT J:PRINT
444 PRINT"Is this order Ok for your regrouped datafile";:GOSUB 21:IF Z$="Y" THEN 459
445 '<UNK! {000A}>--- Get new group order, & check validity of entries ---
446 PRINT"Enter required sequence of groups ---"NG"Group Label Values in Free Format:":INPUT X$:MM=M:M=NG:Q(0)=0:GOSUB 50:M=MM:IF Q(0)=-9 THEN 446
447 KT=0:FOR J=1 TO NG:FOR K=1 TO NG
448 IF L(J)=GP(C(K-1))\1000 THEN KT=KT+1:K=NG
449 NEXT K:NEXT J:IF KT<NG THEN BEEP:PRINT"You've entered 1 or more WRONG LABEL VALUES. Please re-do.":GOTO 446
450 '<UNK! {000A}>--- Remake GP(I-1), I=1 to N, by going thru X(I,TAB) for each label in turn ---
451 K=0:FOR J=1 TO NG
452 FOR I=1 TO N:IF X(I,LAB)=L(J) THEN GP(K)=X(I,LAB)*1000+I:K=K+1
453 NEXT I:NEXT J
454 '<UNK! {000A}>--- Count Group Sizes again ---
455 J=1:N(J)=1:C(J)=0:FOR I=2 TO N
456 IF GP(I-1)\1000=GP(I-2)\1000 THEN N(J)=N(J)+1 ELSE C(J)=C(J-1)+N(J):J=J+1:N(J)=1
460 FOR J=1 TO NG:PRINT TAB(19);USING G$;J;L(J);N(J):IF J=15 THEN GOSUB 5
461 NEXT J:PRINT TAB(32);USING H$;N:PRINT
462 PRINT TAB(15)"Press <Enter> to see Regrouped Data";:LINE INPUT;"";Z$:LOCATE ,1:PRINT SPACE$(60);:LOCATE ,1:GOSUB 43:LOCATE ,1
463 FOR I=1 TO N:GP(I-1)=GP(I-1)-(GP(I-1)\1000)*1000:NEXT I
464 PRINT"REGROUPED DATA:":FOR I=1 TO N
465 PRINT"Row"STR$(I)": ";:FOR J=1 TO M:PRINT X(GP(I-1),J);:NEXT J:PRINT:IF I MOD 20=0 THEN GOSUB 5
466 NEXT I
467 '<UNK! {000A}>--- Delete Bottom Groups? ---
468 DO$="delete any groups from the bottom":GOSUB 20:IF Z$="N" THEN 473
469 PRINT"Delete how many groups (0-"MID$(STR$(NG-1),2)", or Null to re-view the data) ";:INPUT Z$:IF Z$="" THEN 459
470 Q=VAL(Z$):IF Q<0 OR Q>NG-1 THEN BEEP:GOTO 469 ELSE IF Q=0 THEN PRINT"Ok, none deleted!":GOTO 473
471 NG=NG-Q:N=C(NG)
472 '<UNK! {000A}>--- File Regrouped Data ---
473 PRINT:PRINT"Well, let's proceed now to save your rearranged datafile."
474 GOSUB 140
475 '<UNK! {000A}>--- Print Regrouped Data ---
476 BEEP:DO$="print this datafile on your printer":GOSUB 20:IF Z$="N" THEN 486
477 PRINT:COLOR 23,0:PRINT "Turn printer on, then press <ENTER>";:COLOR 7,0:LINE INPUT;"";Z$:LOCATE ,1:PRINT SPACE$(60)
478 LPRINT STRING$(79,"="):LPRINT" ":LPRINT CHR$(14);"R E G R O U P E D D A T A";CHR$(20) '= Wide letters on Epson printers.
479 LPRINT" ":LPRINT"Problem ID: "ID$
480 LPRINT" ":LPRINT"Filename: "FL$:LPRINT" ":IF VN$="N" THEN LPRINT"Variables not named." ELSE FOR J=1 TO M:LPRINT"Var"STR$(J)"="VN$(J)" ";:NEXT J:LPRINT" "
481 LPRINT" ":LPRINT" # GROUP-LABEL SIZE"
482 FOR J=1 TO NG:LPRINT USING G$;J;L(J);N(J):NEXT J:LPRINT USING SPACE$(13)+H$;N
483 LPRINT" ":LPRINT"DATA NOW:":FOR I= 1 TO N
484 LPRINT"Row"STR$(I)": ";:FOR J=1 TO M:LPRINT X(GP(I-1),J);:NEXT J:LPRINT
485 NEXT I:LPRINT" ":LPRINT STRING$(79,"=");STRING$(3,10)