home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel Volume 2 #1
/
carousel.iso
/
comdore
/
64utils
/
filemang.prg
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
1988-12-02
|
8KB
|
322 lines
1 DIMD$(15,4),ID$(1000),RE(1000),F$(15),L(15),PO(15),SL(1000)
2 SP$=" "
3 ER$=" [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]"
10 POKE53281,0:POKE53280,0:PRINT"[147]";
20 PRINT"DO YOU HAVE A DATA DISK ALREADY SET UP"
30 PRINT"(Y/N)?"
40 GETX$:IFX$=""THEN40
45 IF(X$<>"N")AND(X$<>"Y")THEN40
50 IFX$="Y"THEN1000
60 PRINT"[147]PLEASE INSERT A BLANK DISKETTE AND"
70 PRINT"PRESS RETURN...":PRINT:PRINT"REMEMBER, THIS WILL ERASE ANY"
80 PRINT"INFORMATION ON THE DISKETTE"
90 GETX$:IFX$<>CHR$(13)THEN90
100 OPEN15,8,15,"N0:DATA,DD":CLOSE 15
110 OPEN2,8,2,"0:INDEX,S,W":PRINT#2,0:PRINT#2,"LAST NAME":CLOSE 2
120 GOSUB9000
130 PRINT"ENTER DESCRIPTORS, FIELD LENGTHS,"
140 PRINT"PRINTER SPACES, AND PRINTER LINES."
150 PRINT"PRESS CTRL-X WHEN FINISHED"
155 CC=1
160 PRINT""
161 IFCC<10THENPRINTTAB(6);CC;
163 IFCC>9THENPRINTTAB(5);CC;"[157][157][157][157][221]";
165 PRINTTAB(9):LL=14:GOSUB10000
168 IFX$=""THEN200
169 D$(CC,1)=S$
170 PRINT:PRINT"[145]"TAB(25):LL=2:GOSUB10000
178 IFX$=""THEN200
179 D$(CC,2)=S$
180 PRINT:PRINT"[145]"TAB(28):LL=2:GOSUB10000
188 IFX$=""THEN200
189 D$(CC,3)=S$
190 PRINT:PRINT"[145]"TAB(31):LL=2:GOSUB10000
193 IFX$=""THEN200
194 D$(CC,4)=S$
195 CC=CC+1:IFCC<16THEN PRINT:GOTO161
200 CC=CC-1
210 PRINT" "
211 PRINT" "
212 PRINT" ":PRINT"";
213 INPUT"ENTER THE INDEX DESCRIPTOR ";IN
215 IF IN<1 OR IN>CCTHEN210
216 RL=0:FORI=1TOCC:RL=RL+VAL(D$(I,2)):NEXT
217 IFRL<251THEN220
218 PRINT"[147]ERROR...FIELD LENGTHS EXCEED 250...":PRINT"PLEASE REDO!":FORI=1TO1500:NEXT
219 GOTO120
220 FORI=1TOCC:IFVAL(D$(CC,2))>20THEN224
221 NEXT:GOTO225
224 PRINT"[147]ERROR...FIELD > 20":PRINT"PLEASE REDO!":FORI=1TO1500:NEXT:GOTO120
225 PRINT"[147] WRITING INFO TO DISK"
226 RR=INT(153600/RL)
227 PRINT:PRINT"YOU MAY ENTER UP TO";RR;"RECORDS"
228 NR=0
230 OPEN2,8,2,"@0:INDEX,S,W"
240 PRINT#2,CC
250 FORI=1TOCC:FORJ=1TO4:PRINT#2,D$(I,J):NEXT:NEXT
260 PRINT#2,IN
264 RR=INT(153600/RL)
265 PRINT#2,RL
266 PRINT#2,NR
270 CLOSE 2
275 OPEN2,8,2,"REC,L,"+CHR$(RL):CLOSE 2
276 NR=0
278 GOSUB5600
280 GOTO 2000
999 END
1000 PRINT"[147]PLEASE INSERT YOUR DATA DISKETTE AND"
1001 PRINT"PRESS RETURN..."
1002 GETX$:IFX$<>CHR$(13)THEN1002
1005 GOSUB5100:GOSUB5200
1099 GOTO 2000
2000 PRINT"[147]"TAB(9)"FILE MANAGER MAIN MENU[146]"
2010 PRINT""TAB(9)"1) ADD A RECORD"
2030 PRINT""TAB(9)"2) CHANGE OR DELETE A RECORD"
2040 PRINT""TAB(9)"3) CHANGE THE PRINTING FORMAT"
2050 PRINT""TAB(9)"4) PRINT A RECORD"
2060 PRINT""TAB(9)"5) PRINT ALL RECORDS"
2065 PRINT""TAB(9)"6) CHANGE THE INDEXOR"
2070 PRINT""TAB(9)"7) EXIT"
2080 PRINT""
2090 GETX$:IFX$=""THEN2080
2091 IFX$<"1"ORX$>"7"THEN2090
2092 ONASC(X$)-48GOTO2100,2300,2400,2500,2600,2700,20000
2100 REM ADD A RECORD
2102 IFNR=RRTHENPRINT"[147]TOO MANY RECORDS...":FORI=1TO1500:NEXT:GOTO2000
2110 FORI=1TOCC:F$(I)=LEFT$(SP$,L(I)):NEXT
2120 GOSUB 9100
2130 PRINT"PRESS CTRL-X WHEN DONE"
2140 C9=1:PRINTTAB(19);"";
2150 LL=L(C9):GOSUB10000
2155 F$(C9)=S$
2160 IFX$=""THEN2190
2170 C9=C9+1:IFC9>CCTHENC9=1
2180 PRINT"":PRINTTAB(19);:FORI=1TOC9:PRINT"";:NEXT:PRINTER$;
2185 GOTO2150
2190 PRINT"[147] ADDING THE RECORD..."
2192 FORI=1TOCC:F$(I)=F$(I)+RIGHT$(SP$,(L(I))-LEN(F$(I))):NEXT
2195 GOSUB5400:GOTO2000
2200 IFFL=NRTHENNR=NR-1:GOTO2240
2210 R=NR:GOSUB5000
2220 GOSUB5700
2230 NR=NR-1
2240 GOSUB5500
2250 GOTO 2000
2300 PRINT"[147]PLEASE ENTER THE ";D$(IN,1);:INPUT" ";SS$
2301 SS$=SS$+LEFT$(SP$,L(IN)-LEN(SS$)):GOSUB5300
2302 IFFL=0THEN2000
2303 R=FL
2305 GOSUB5000
2310 GOSUB9100
2315 PRINT"";SP$;SP$;SP$;"";
2320 PRINT"ENTER THE FIELD NUMBER TO BE CHANGED ";
2330 PRINT"OR ENTER 'DELETE' TO DELETE THE ENTRY"
2331 FF$="*"
2340 INPUTFF$:IFFF$="DELETE"THEN2200
2350 FF=VAL(FF$):IFFF<0ORFF>CCTHEN2315
2355 IFFF=0THEN2000
2360 PRINT"":PRINTTAB(19);:FORI=1TOFF:PRINT"";:NEXT:PRINTER$;
2365 LL=L(FF):GOSUB10000
2366 F$(FF)=S$
2370 F$(FF)=F$(FF)+RIGHT$(SP$,(L(FF))-LEN(F$(FF)))
2375 PRINT"";SP$;SP$;SP$;"";
2380 PRINT"MORE CHANGES? (Y/N)
2381 [161]X$:[139]X$[178]""[167]2381
2382 [139]X$[178]"Y"[167]2315
2383 [139]X$[178]"N"[167]2390
2385 [137]2381
2390 [153]"LOADSAVING CHANGES...":[141]5700
2399 [137]2000
2400 [153]"LOADTHE PRINTING SPACING IS CURRENTLY...":[153]
2405 [153]"DESCRIPTOR SPACES LINES":[153]
2410 [129]I[178]1[164]CC:[153]I;" ";D$(I,1):[130]
2420 [153]"":[129]I[178]1[164]CC:[153][163]23);D$(I,3);" ";D$(I,4):[130]
2430 [153]:[153]:AN$[178]"*":[133]"CHANGE WHICH NUMBER (<CR> TO END)";AN$
2440 AN[178][197](AN$):[139]AN[179]1[176]AN[177]CC[167][141]5500:[137]2000
2450 [133]"ENTER NEW VALUES (SPACES,LINES)";S1,L1:[139]S1[177]99[176]S1[179]0[167][153]"ONON":[137]2450
2455 [139]L1[177]99[176]L1[179]0[167][153]"ONON":[137]2450
2460 D$(AN,3)[178][201]([196](S1),2)
2465 D$(AN,4)[178][201]([196](L1),2)
2466 [139]S1[179]10[167]D$(AN,3)[178]"0"[170][201]([196](S1),1)
2467 [139]L1[179]10[167]D$(AN,4)[178]"0"[170][201]([196](L1),1)
2470 [137]2400
2499 [144]
2500 [153]"LOADPLEASE ENTER THE ";D$(IN,1);:[133]" ";SS$
2501 SS$[178]SS$[170][200](SP$,L(IN)[171][195](SS$)):[141]5300
2502 [139]FL[178]0[167]2000
2503 R[178]FL
2505 [141]5000
2506 [153]"LOAD PADDED SPACES ? (Y/N)
2507 GETX$:IFX$=""THEN2507
2508 IFX$="Y"THEN2515
2509 FORI=1TOCC
2510 IFRIGHT$(F$(I),1)<>" "THEN2514
2511 F$(I)=LEFT$(F$(I),LEN(F$(I))-1):GOTO2510
2514 NEXT
2515 PRINT"[147] ADJUST PRINTER AND PRESS RETURN"
2520 GETX$:IFX$<>CHR$(13)THEN2520
2525 PRINT"[147] PRINTING..."
2530 OPEN1,4
2540 FORI=1TOCC
2550 IFVAL(D$(I,4))=0THEN2560
2555 FORJ=1TOVAL(D$(I,4)):PRINT#1,:NEXT
2560 IFVAL(D$(I,3))=0THEN2570
2565 FORJ=1TOVAL(D$(I,3)):PRINT#1," ";:NEXT
2570 PRINT#1,F$(I);:NEXT
2575 PRINT#1,
2580 CLOSE 1
2590 GOTO2000
2600 PRINT"[147]PADDED SPACES ? (Y/N)
2601 [161]B$:[139]B$[178]""[167]2601
2602 [133]"HOW MANY LINES TO SEPERATE ENTRIES";L5
2603 [129]I4[178]1[164]NR:SL(I4)[178]I4:[130]
2604 [141]5800
2606 [153]"LOAD ADJUST PRINTER AND PRESS RETURN"
2607 [161]Z$:[139]Z$[179][177][199](13)[167]2607
2608 [129]KK[178]1[164]NR:R[178]SL(KK):[141]5000
2609 [139]B$[178]"Y"[167]2650
2610 [129]JJ[178]1[164]CC
2611 [139][201](F$(JJ),1)[179][177]" "[167]2614
2612 F$(JJ)[178][200](F$(JJ),[195](F$(JJ))[171]1):[137]2611
2614 [130]
2650 [159]1,4
2660 [129]I[178]1[164]CC
2665 [139][197](D$(I,4))[178]0[167]2675
2670 [129]J[178]1[164][197](D$(I,4)):[152]1,:[130]
2675 [139][197](D$(I,3))[178]0[167]2685
2680 [129]J[178]1[164][197](D$(I,3)):[152]1," ";:[130]
2685 [152]1,F$(I);:[130]
2686 [129]I[178]1[164]L5:[152]1,:[130]
2687 [160] 1
2688 [130]
2699 [137]2000
2700 [153]"LOAD":[129]I[178]1[164]CC:[153]I;" ";D$(I,1):[130]
2710 [153]:[153]"CURRENTLY THE INDEXOR IS ";D$(IN,1)
2720 [133]"ENTER A NEW INDEXOR ";II
2730 [139]II[179]0[176]II[177]CC[167]2700
2740 IN[178]II
2750 [153]"LOADCHANGING INDEXOR TO ";D$(IN,1)
2760 [141]5500:[141]5200:[137]2000
2890 [137]2000
4999 [128]
5000 [143] RETRIEVE A RECORD
5005 [141]5900
5010 R1[178]R:R2[178]0:[139]R1[177]256[167]R2[178][181](R1[173]256):R1[178]R1[171]256[172]R2
5020 [159]1,8,15:[159]2,8,2,"REC"
5025 [152]1,"P"[199](2)[199](R1)[199](R2)[199](1):[141]6000:S9$[178]Z9$
5040 [129]I[178]1[164]CC:F$(I)[178][202](S9$,PO(I),L(I)):[130]
5070 [160] 1:[160] 2
5099 [142]
5100 [143] ROUTINE TO READ SEQ FILE
5105 [159]2,8,2,"0:INDEX,S,R"
5110 [132]2,CC:[129]I[178]1[164]CC:[129]J[178]1[164]4:[132]2,D$(I,J):[130]:[130]:[132]2,IN
5120 [132]2,RL
5125 RR[178][181](153600[173]RL)
5130 [132]2,NR:[160] 2
5140 [141]5600
5199 [142]
5200 [143]ROUTINE TO READ IN INDEXORS AND REC NUMBERS
5201 [139]NR[178]0[167] [142]
5210 [159]2,8,2,"REC"
5220 [159]1,8,15
5240 [129] I[178]1[164]NR
5245 R1[178]I:R2[178]0:[139]R1[177]256[167]R2[178][181](R1[173]256):R1[178]R1[171]256[172]R2
5250 [152]1,"P"[199](2)[199](R1)[199](R2)[199](1)
5260 SL(I)[178]I:RE(I)[178]I:[141]6000:ID$(I)[178]Z9$
5265 ID$(I)[178][202](ID$(I),PO(IN),L(IN))
5267 [130]
5270 [160] 1:[160] 2
5299 [142]
5300 [143] ROUTINE TO SEARCH FOR INDEXOR SS$
5310 FL[178]0
5320 [129]I[178]1[164]NR
5330 [139]ID$(I)[178]SS$[167]FL[178]I:[142]
5340 [130]
5345 [153]"LOAD RECORD NOT FOUND!":[129]I[178]1[164]1500:[130]
5399 [142]
5400 [143] ADD A RECORD
5410 R1[178]NR[170]1:NR[178]R1:R2[178]0:[139]R1[177]256[167]R2[178][181](R1[173]256):R1[178]R1[171]256[172]R2
5420 [159]1,8,15:[159]2,8,2,"REC"
5425 [152]1,"P"[199](2)[199](R1)[199](R2)[199](1)
5426 S9$[178]""
5430 [129]I[178]1[164]CC
5450 S9$[178]S9$[170]F$(I)
5460 [130]
5465 [152]2,S9$;
5470 [160] 1:[160] 2
5480 ID$(NR)[178]F$(IN):RE(NR)[178]NR
5485 [141]5500
5499 [142]
5500 [143] ROUTINE TO WRITE SEQ FILE
5505 [159]2,8,2,"@0:INDEX,S,W"
5510 [152]2,CC:[129]I[178]1[164]CC:[129]J[178]1[164]4:[152]2,D$(I,J):[130]:[130]:[152]2,IN
5520 [152]2,RL
5530 [152]2,NR:[160] 2
5599 [142]
5600 [129]I[178]1[164]CC:L(I)[178][197](D$(I,2)):PO(I)[178]0:[130]
5610 PO(1)[178]1:[129]I[178]2[164]CC:PO(I)[178]PO(I[171]1)[170]L(I[171]1):[130]
5699 [142]
5700 [143] SAVE A RECORD CHANGE
5710 R1[178]FL:R2[178]0:[139]R1[177]256[167]R2[178][181](R1[173]256):R1[178]R1[171]256[172]R2
5720 [159]1,8,15:[159]2,8,2,"REC"
5725 [152]1,"P"[199](2)[199](R1)[199](R2)[199](1)
5726 S9$[178]""
5730 [129]I[178]1[164]CC
5750 S9$[178]S9$[170]F$(I)
5760 [130]
5765 [152]2,S9$;
5770 [160] 1:[160] 2
5780 ID$(FL)[178]F$(IN)
5799 [142]
5800 [143] ROUTINE TO SORT BY INDEXOR
5810 [153]"LOADDO YOU WISH TO SORT (Y/N)"
5820 [153]:[153]"WARNING!!! TO SORT A LARGE NUMBER"
5830 [153]"OF RECORDS WILL TAKE A FEW MINUTES"
5840 [161]Q$:[139]Q$[178]""[167]5840
5850 [139]Q$[178]"N"[167][142]
5860 [129] I5[178]1[164]NR:[129]J5[178]1[164]NR[171]1
5870 [139]ID$(SL(J5))[177]ID$(SL(J5[170]1))[167]T5[178]SL(J5):SL(J5)[178]SL(J5[170]1):SL(J5[170]1)[178]T5
5880 [130]:[130]
5899 [142]
5900 [143] RESET
5905 [159]15,8,15:[152]15,"I":[160] 15
5910 [160] 1:[160] 2:[160] 15:[160] 3
5999 [142]
6000 Z9$[178]"":[129]X5[178]1[164]RL:[161]#2,Z8$:Z9$[178]Z9$[170]Z8$:[130]:[142]
9000 [153]"LOAD"
9003 [153][163]5)"ORTANTAN=TANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN=TANTAN=TANTAN=TANTAN^"
9005 [153][163]5)"(null) #(null) DESCRIPTOR (null)FL(null)SP(null)LN(null)"
9010 [153][163]5)"-TANTAN(null)TANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN(null)TANTAN(null)TANTAN(null)TANTAN<"
9015 [129]I[178]1[164]15
9020 [153][163]5)"(null) (null) (null) (null) (null) (null)"
9025 [130]
9030 [153][163]5)"/TANTAN>TANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN>TANTAN>TANTAN>TANTANEXP";
9099 [142]
9100 [153]"LOAD"
9103 [153]"ORTANTAN=TANTANTANTANTANTANTANTANTANTANTANTANTANTAN=TANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN^";
9105 [153]"(null) #(null) DESCRIPTOR (null) DATA (null)";
9110 [153]"-TANTAN(null)TANTANTANTANTANTANTANTANTANTANTANTANTANTAN(null)TANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN<";
9115 [129]I[178]1[164]15
9116 N9$[178][201]([196](I),2):D9$[178]D$(I,1)
9117 [139][195](D9$)[179]14[167]D9$[178]D9$[170][201](SP$,14[171][195](D9$))
9118 [139]I[177]CC[167]N9$[178]" "
9120 [153]"(null)"N9$"(null)"D9$"(null) (null)";
9125 [130]
9130 [153]"/TANTAN>TANTANTANTANTANTANTANTANTANTANTANTANTANTAN>TANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANEXP";
9139 [129]C8[178]1[164]CC
9140 [153]"":[153][163]19);:[129]I[178]1[164]C8:[153]"";:[130]:[153]F$(C8);
9141 [130]
9199 [142]
10000 CU$[178]" WAITCMD"
10001 S$[178]"":[153]CU$;
10005 [161]X$:[139]X$[178]""[167]10005
10010 [139]X$[178][199](13)[175]S$[179][177]"" [167] [153]" ";:[142]
10011 [139]X$[178]""[167] [153]" ";:[142]
10014 L9[178][195](S$)
10015 [139]X$[178][199](20)[175]L9[179][177]0[167][153]" CMDCMD";CU$;:S$[178][200](S$,([195](S$)[171]1)):[137] 10005
10016 [139]X$[178][199](20)[167]10005
10019 [139](X$[179]" ")[176](X$[177]"_")[167] 10005
10020 S$[178]S$[170]X$:[153]X$;:[139] [195](S$)[178]LL[167][142]
10025 [153]CU$;:[137] 10005
20000 [128]