8-Bit Software Online Conversion

:2.$.DBsort - Listing

10DEFFNS="DBsort" 20PROCa:MODE7:VDU23;8202;0;0;0; 25PROCd("Sort database by C.J.Richard son") 30*. 40PROCd("File to sort. RETURN for DBd at"):INPUTF$:IFF$="" F$="DBdat" 50F%=OPENIN F$:PROCd("LOADING. "+F$+" Please wait.") 60INPUT#F%,Q% 70DIM S$(11,Q%),N$(10) 80FORL%=0TO10:INPUT#F%,N$(L%):NEXT:FO RL%=1TOQ%:INPUT#F%,S$(1,L%),S$(2,L%),S$( 3,L%),S$(4,L%),S$(5,L%),S$(6,L%),S$(7,L% ),S$(8,L%),S$(9,L%),S$(10,L%),S$(11,L%): NEXT:CLOSE#F%:CLS 90PRINTN$(0);S$(1,1) 100PRINTN$(1);S$(2,1) 110PRINTN$(2);S$(3,1) 120PRINTN$(3);S$(4,1) 130PRINTN$(4);S$(5,1) 140PRINTN$(5);S$(6,1) 150PRINTN$(6);S$(7,1) 160PRINTN$(7);S$(8,1) 170PRINTN$(8);S$(9,1) 180PRINTN$(9);S$(10,1) 190PRINTN$(10);S$(11,1)'' 200PROCd("Sort by which field?"):REPEA T:A$=GET$:A%=VALA$ 210UNTILA%>0 OR A$="A"ORA$="B" 220IFA$="A"A%=10 230IFA$="B"A%=11 240PROCs 250PROCsave 260CHAIN"DBASE" 270DEFPROCs:LOCALl%,l$,e%,i%:FORl%=1TO Q%:PRINTTAB(0,22);" SORTING "+STR$(l%) 280l$=FNc(S$(A%,l%)):e%=l% 290FOR i%=l%TOQ%:IF S$(1,i%)<>"" IFFNc (S$(A%,i%))<l$ l$=FNc(S$(A%,i%)):e%=i% 310NEXT 320FORI%=1TO11:l$=S$(I%,l%):S$(I%,l%)= S$(I%,e%):S$(I%,e%)=l$:NEXT:NEXT:ENDPROC 330DEFFNc($&C50):CALL&C00:=$&C50 340DEFPROCa:FORl%=0TO2STEP2:P%=&C00:[: OPT l%:LDY#&FF:.loop:INY:LDA&C50,Y:CMP#1 3:BEQout:CLC:SBC#96:BCCloop:ADC#64:STA&C 50,Y:JMP loop:.out:RTS:]:NEXT:ENDPROC 350DEFPROCsave 360INPUT" SAVE WHICH FILE? RETURN=dbda t "L$:IFL$=""L$="dbdat" 370F%=OPENOUT L$:PRINT#F%,Q% 380FORL%=0TO10:PRINT#F%,N$(L%):NEXT:FO RL%=1TOQ%:PRINT#F%,S$(1,L%),S$(2,L%),S$( 3,L%),S$(4,L%),S$(5,L%),S$(6,L%),S$(7,L% ),S$(8,L%),S$(9,L%),S$(10,L%),S$(11,L%): NEXT:CLOSE#F% 390ENDPROC 400DEFPROCd(A$):A$=A$+STRING$(LENA$MOD 2," "):FORL%=1TOLENA$:PRINTTAB(18-L%/2); "   %/2):VDU11,11:NEXT:VDU10,10:ENDPROC