home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun: Productivity Pak 2 / rerun-productivity-pak-ii.d64 / datafile (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1986-01-01  |  8.8 KB  |  272 lines

  1. 5 iffl=0thenfl=1:load"dp] ssort",8,1
  2. 6 iffl=1thenfl=2:load"dp] dos5.1",8,1
  3. 7 iffl=2thenfl=3::sys52224
  4. 8 rem ssort by david peterson, dos5.1 (c) by commodore
  5. 10 rem datafile 3.6 (c)1986 by mike konshak
  6. 12 poke53280,0:poke53281,0:print"[158]":gosub16:gosub600:goto68
  7. 16 d$="":mr$=d$:dr$=d$:s=0:b1$=d$:pw=0:cw=0:b$=chr$(32):fl=0:l$="":e=0
  8. 18 nc=0:nl=0:pg=0:f1=0:f2=0:f3=0:l$=d$:rl=0:sb$=d$:cr$=chr$(13):hn$=d$:id$=d$
  9. 20 a$=d$:c$=d$:t%=0:i$=d$:ck=0:i=0:j=0:k=0:l=0:m=0:n=0:rw=5:sf=0:z=0:e$="eof"
  10. 22 en=0:em$=d$:et=0:es=0:a1$=d$:a2$=d$:a3$=d$:s1$=d$:ts%=0:mem=29500:return
  11. 24 dim f$(f+1),l%(f+1):return
  12. 26 dim rec$(r+1,f+1),k%(r+1),s(6):return
  13. 28 :
  14. 30 geta$:ifa$=""then30
  15. 32 return
  16. 34 :
  17. 36 ifck<>0thengosub394:ifa$<>"n"then68
  18. 37 clr:goto40
  19. 38 print"[147]    initialize (create) a record file  ":return
  20. 40 gosub38:gosub16:input"how many fields in each record[158]? 0 [157][157][157][157]";f
  21. 41 iff=0then68
  22. 42 gosub24
  23. 43 fori=1tof
  24. 44 gosub38:print"[153]field #";i:print"[153]title[158] ? >[145]":printtab(8)f$(i)
  25. 46 print"[153]length[158]? 0[145]":printtab(7)l%(i)""
  26. 47 print"";tab(6);:inputf$(i):iff$(i)=""thenf$(i)=">"
  27. 48 printtab(6);:inputl$:ifl$="0"then68
  28. 49 ifval(l$)>(78-len(f$(i)))orval(l$)=0thengosub602:print"[145][145]":goto48
  29. 50 l%(i)=val(l$):nexti:rl=0
  30. 51 :
  31. 52 forj=0tof:rl=rl+l%(j):nextj:rl=rl+3*(f+1)+5:r=int((mem-12*(f+1)-2100)/rl)
  32. 54 print"[153] your selections allow [158]"r"[153]records."
  33. 56 print" a[146][153]ccept c[146][153]hange field data or r[153][146]eject?[158]"
  34. 57 gosub30:ifa$="r"then37
  35. 58 ifa$="c"then43
  36. 59 ifa$="a"thengosub26:ck=1:goto61
  37. 60 gosub602:goto57
  38. 61 fori=1tof:iflen(f$(i))>s1thens1=len(f$(i))
  39. 62 nexti:goto68
  40. 64 :
  41. 68 print"[147][158]  datafile 3.6 (c)1986 by mike konshak "
  42. 70 printtab(3)"c[153][146]reate new file   q[153][146]uit program
  43. 72 [153][163]3)"aprintwaitdd record to current file
  44. 74 printtab(3)"m[153][146]odify record in current file
  45. 76 [153][163]3)"dprintwaitelete record in current file
  46. 78 printtab(3)"v[153][146]iew or edit file [158]"nf$"[146][153]
  47. 80 [153][163]3)"sprintwaitort records by field
  48. 82 printtab(3)"p[153][146]rint records using [158]dfprint[153]/[158]dfcalc
  49. 84 [153][163]3)"rprintwaitead (load) old file from disk
  50. 86 printtab(3)"w[153][146]rite (save) current file to disk
  51. 88 [153][163]3)"@printwait disk drive commands $wait 4waitprint directory"
  52. 90 [153]"sys       press the appropriate key       "
  53. 92 [153]"print  there aresys";x;"printrecords in memorysys"
  54. 94 [139]r[177]0[167][153]"print  space forsys";r[171]x;"printmore recordsonsys"
  55. 96 [141]30:[139]a$[178]"a"[167][141]350:[139]fl[178]0[167]124
  56. 98 [139]a$[178]"m"[167][141]354:[139]fl[178]0[167]244
  57. 100 [139]a$[178]"d"[167][141]354:[139]fl[178]0[167]272
  58. 102 [139]a$[178]"c"[167]36
  59. 104 [139]a$[178]"r"[167]170
  60. 106 [139]a$[178]"p"[167]358
  61. 108 [139]a$[178]"v"[167][141]354:[139]fl[178]0[167]192
  62. 110 [139]a$[178]"w"[167][141]350:[139]fl[178]0[167]144
  63. 112 [139]a$[178]"s"[167][141]354:[139]fl[178]0[167]304
  64. 114 [139]a$[178]"q"[167]342
  65. 116 [139]a$[178]"@"[167]462
  66. 117 [139]a$[178]"$"[176]a$[178]"4"[167][141]422:[137]68
  67. 118 [139]fl[179][177]0[167]fl[178]0:[137]68
  68. 120 [141]602:[137]96
  69. 122 :
  70. 124 [129]i[178]x[170]1[164]r:[153]"loadprint press the returnwaitprint key after each entry"
  71. 126 [153]" press returnprintwait without any entry to stopsys"
  72. 128 [153]" record number ";i;""
  73. 130 [129]n[178]1[164]f
  74. 132 [153]f$(n)[166]s1[171][195](f$(n)))"   >cmdcmdcmd";:[133]rec$(i,n)
  75. 133 [139]rec$(i,n)[178]""[167]rec$(i,n)[178]">"
  76. 134 [139][195](rec$(i,n))[177]l%(n)[167][141]140:[137]132
  77. 135 [139]rec$(i,n)[178]"="[167]rec$(i,n)[178]rec$(i[171]1,n)
  78. 136 [139]rec$(i,1)[178]">"[167] x[178]i[171]1:ck[178]1:[137]68
  79. 138 [130]n:k%(i)[178]i:[130]i:x[178]r:ck[178]1:[137]68
  80. 140 [153]" defcannot exceed"[196](l%(n))" characterswaitsys":[141]602:[142]
  81. 142 :
  82. 144 [153]"loadprintenter name of current file to be saved"
  83. 146 [153]"(12 characters max).  any existing file"
  84. 148 [153]"with the same name will be scratched.sys"
  85. 150 [153]"  ";nf$:[133]"on";nf$:[139]nf$[178]""[167]68
  86. 152 [159]15,8,15:[152]15,"s0:df] "[170][200](nf$,8)[170]".bak":[141]414:[139]et[178]8[167]68
  87. 154 [152]15,"r0:df] "[170][200](nf$,8)[170]".bak=df] "[170]nf$:[141]414:[139]et[178]8[167]68
  88. 156 [159]5,8,5,"0:df] "[170]nf$[170]",s,w":[141]414:[139]et[178]8[167]68
  89. 158 [152]5,r;cr$;f;cr$;x:[129]n[178]1[164]f:[152]5,f$(n);cr$;l%(n):[130]n
  90. 159 [141]414:[139]et[178]8[167]68
  91. 160 [129]i[178]1[164]x:[153]"print saving record #sys"i"onon"
  92. 162 [129]n[178]1[164]f:[152]5,rec$(k%(i),n):[130]n:[130]i:[153]:[141]414:[139]et[178]8[167]68
  93. 166 [160]5:[160]15:ck[178]0:[137]68
  94. 168 :
  95. 170 [139]ck[179][177]0[167][141]394:[139]a$[179][177]"n"[167]68
  96. 171 [153]"loadprint available files on disk are:sys":@"$0:df]*"
  97. 172 [156]:[141]16:[153]"print enter name of file to be loadedsys":[133]nf$
  98. 173 [139]nf$[178]""[167]68
  99. 174 [159]15,8,15:[159]5,8,5,"0:df] "[170]nf$[170]",s,r":[141]414:[139]et[178]8[167]68
  100. 175 [139]en[178]62[167][141]416:[137]68
  101. 176 [132]5,r,f,x:[141]414:[139]et[178]8[167]68
  102. 177 [141]24:[141]26:[129]n[178]1[164]f:[132]5,f$(n),l$:l%(n)[178][197](l$)
  103. 178 [130]n:[141]414:[139]et[178]8[167]68
  104. 179 [129]i[178]1[164]x:k%(i)[178]i:[153]"printloading record #sys"i"onon"
  105. 180 [129]n[178]1[164]f:[132]5,rec$(i,n):[130]n
  106. 182 [130]i:[153]:[141]414:[139]et[178]8[167]68
  107. 184 s[178]st:[139]s[179][177]0[167]188
  108. 188 [160]5:[160]15:[137]61
  109. 190 :
  110. 192 i[178]1
  111. 194 [139]i[178]0[167]i[178]x
  112. 196 [139]i[177]x[167]i[178]1
  113. 198 [153]"load record number:"[196](i)"  file:"nf$""
  114. 200 [129]n[178]1[164]f:[153]"print"f$(n)[166]s1[171][195](f$(n)))" sys"rec$(k%(i),n):[130]n
  115. 202 [153]" nprintwaitext    lprintwaitast    jprintwaitump    fprintwaitind"
  116. 203 [153]" mprintwaitodify  dprintwaitelete  pprintwaitrint   eprintwaitxitsys"
  117. 204 [141]30:[139]a$[178]"n"[167]i[178]i[170]1:[137]194
  118. 206 [139]a$[178]"l"[167]i[178]i[171]1:[137]194
  119. 207 [139]a$[178]"m"[167][141]256:[137]198
  120. 208 [139]a$[178]"j"[167]216
  121. 209 [139]a$[178]"d"[167][141]284:[137]198
  122. 210 [139]a$[178]"f"[167]218
  123. 212 [139]a$[178]"e"[167]68
  124. 213 [139]a$[178]"p"[167][159]4,4:[152]4,"record#"i"in file: "nf$:[152]4:[137]215
  125. 214 [141]602:[137]204
  126. 215 [129]n[178]1[164]f:[152]4,rec$(k%(i),n):[130]n:[152]4:[152]4:[160]4:[137]204
  127. 216 [133]"print jump to record numbersys";i:[137]194
  128. 218 [153]"load    find records with common items "
  129. 220 [129]n[178]1[164]f:[153]" ";n;"printwait ";f$(n):[130]n
  130. 222 [133]"print which field is to be searchedsys? 0 cmdcmdcmdcmd";sf:[139]sf[178]0[167]68
  131. 224 [139]sf[179]1[176]sf[177]f[167][153]"ononon":[137]222
  132. 226 [153]"print enter common itemwait ":[153]" (the entire string is not required)sys"
  133. 228 [153]"";f$(sf);"wait ";:[133]t$:[139]t$[178]d$[167]68
  134. 230 j[178]i:[129]i[178]1[164]x:[153]"print searching recordssys"i"onon"
  135. 232 [139]t$[178][200](rec$(k%(i),sf),[195](t$))[167]236
  136. 234 [137]241
  137. 236 j[178]i:[153]"load record #";i;""
  138. 237 [129]n[178]1[164]f:[153]"print"f$(n)[166]s1[171][195](f$(n)))" sys"rec$(k%(i),n):[130]n
  139. 238 [153]" nprintwaitext  mprintwaitodify  dprintwaitelete  ewaitprintxitsys":[141]30:[139]a$[178]"e"[167]198
  140. 239 [139]a$[178]"m"[167][141]256:[137]236
  141. 240 [139]a$[178]"d"[167][141]284:[137]236
  142. 241 [130]i:i[178]j:[137]198
  143. 242 :
  144. 244 [153]"loadprint modify which record? enter #waitprint or aprintwaitllsys"
  145. 245 [133]mr$:[139]mr$[178]d$[167]68
  146. 246 [139]mr$[178]"a"[167]mr$[178]d$:[137]254
  147. 248 i[178][197](mr$):mr$[178]d$
  148. 250 [139]i[177]x[167][141]348:[137]244
  149. 252 [141]256:[137]68
  150. 254 [129]i[178]1[164]x:[141]256:[153]" nwaitprintext or eprintwaitxitsys":[141]30:[139]a$[178]"e"[167]68
  151. 255 [130]i:[137]68
  152. 256 [153]"loadprint to modify record #sys";i;"print, make changes"
  153. 258 [153]" as each field is displayed, then returnwaitsys":[129]n[178]1[164]f
  154. 260 [153]"print"f$(n)" sys":[153]"   ";rec$(k%(i),n)
  155. 261 [139][195](rec$(k%(i),n))[177]36[167][153]"on";
  156. 262 [153]"on ";:[133]rec$(k%(i),n)
  157. 264 [139][195](rec$(k%(i),n))[177]l%(n)[167][141]140:[137]260
  158. 265 [139]rec$(k%(i),n)[178]"="[167]rec$(k%(i),n)[178]rec$(k%(i[171]1),n)
  159. 266 [139]rec$(k%(i),n)[178]""[167]rec$(k%(i),n)[178]">"
  160. 267 [139][200](rec$(k%(i),n),1)[178]">"[167]rec$(k%(i),n)[178]">"
  161. 268 [130]n:ck[178]1:[142]
  162. 270 :
  163. 272 [153]"loadprint delete which record? enter #printwait or aprintwaitllsys"
  164. 274 [133]dr$:[139]dr$[178]d$[167]68
  165. 276 [139]dr$[178]"a"[167]dr$[178]d$:[137]282
  166. 278 i[178][197](dr$):dr$[178]d$:[139]i[177]x[167][141]348:[137]274
  167. 280 [141]284:[137]68
  168. 282 [129]i[178]1[164]x:[141]284:[153]" nwaitprintext or ewaitprintxitsys":[141]30:[139]a$[178]"e"[167]68
  169. 283 [130]i:[137]68
  170. 284 [153]"loadprint to delete record numbersys";i;"print, press"
  171. 286 [153]" shiftwait dwaitprint, press space barwaitprint to advancesys"
  172. 288 [129]n[178]1[164]f:[153]"print"f$(n)[166]s1[171][195](f$(n)))" sys"rec$(k%(i),n):[130]n
  173. 290 [141]30:[139]a$[178]"str$"[167]294
  174. 292 ck[178]1:[142]
  175. 294 [153]"deleting record";i:[153]"records may now be out of order"
  176. 296 [129]n[178]1[164]f:rec$(k%(i),n)[178]rec$(x,n):rec$(x,n)[178]"":[130]n
  177. 298 [129]j[178]1[164]x:[139]k%(j)[178]x[167]k%(j)[178]k%(x):k%(x)[178]0:x[178]x[171]1:[137]292
  178. 300 [130]j
  179. 302 :
  180. 304 [153]"load    sort records in ascending order   "
  181. 306 [129] n[178]1[164]f:[153]" ";n;"wait ";f$(n):[130]n
  182. 308 [129]n[178]0[164]5:s(n)[178]0:[130]n
  183. 310 n[178]0:[153]"print enter 0waitprint to exit field selection"
  184. 312 n[178]n[170]1:[139]n[178]6[167]320
  185. 314 [153]"print # "n"printwaitfield to be sortedsys? 0 cmdcmdcmdcmd";:[133]s(n):[139]s(1)[178]0[167]68
  186. 316 [139](s(n)[177]f)[176](s(n)[179]0)[167][153]"onon":[137]314
  187. 318 [139]s(n)[179][177]0[167]312
  188. 320 [153]" sorting..."
  189. 322 l[178]r[170]1:[158]51526,l,x,f,s(1),s(2),s(3),s(4),s(5),s(0),rec$(1,s(1))
  190. 324 [129]i[178]1[164]x:k%(i)[178]i:[130]
  191. 326 ck[178]1:[137]68
  192. 333 :
  193. 334 [153]"load defyou have not saved your changes!sys"
  194. 336 [153]"print do you really want to quit? defyprintwait or nwaitsys
  195. 338 gosub30:ifa$="y" then344
  196. 340 goto68
  197. 342 ifck<>0then334
  198. 344 print"[147]datafile terminated":end
  199. 346 :
  200. 348 print" [150]no such record exists[158]":return
  201. 350 ifr>0thenreturn
  202. 352 print" [150]    no records or files in memory     [158][146]"
  203. 353 fori=1to500:nexti:fl=1:return
  204. 354 ifx>0thenreturn
  205. 355 gosub352:return
  206. 356 :
  207. 358 ifck<>0thengosub394:ifa$<>"n"then68
  208. 360 print"[147]     transfer to printing programs     "
  209. 362 print"[153]put [158]datafile[153] disk in drive, transfer to:"
  210. 364 printtab(6)"p[146][158] dfprint  [153]reports-labels-lists"
  211. 366 printtab(6)"c[146][158] dfcalc   [153]calculated reports"
  212. 368 printtab(6)"e[146][153]xit to main menu[158]
  213. 370 [153]"       press the appropriate key       "
  214. 372 [141]30:[139]a$[178]"e"[167]68
  215. 374 [139]a$[178]"c"[167][153]"loadstopload"[199](34)"dfcalc"[199](34)",8":[137]380
  216. 376 [139]a$[178]"p"[167][153]"loadstopload"[199](34)"dfprint"[199](34)",8":[137]380
  217. 378 [141]602:[137]372
  218. 380 [153]:[153]:[153]:[153]:[153]"runsys"
  219. 382 [151]631,19:[151]632,13:[151]633,13:[151]634,13:[151]635,13:[151]636,13
  220. 384 [151]198,6:[162]:[128]
  221. 392 :
  222. 394 [153]"load defthis will destroy the file in memory!sys"
  223. 396 [153]"print save the file first? yprintwait or defnsyswait":[141]30:[142]
  224. 400 :
  225. 402 [153]"loaddef this will erase the disk!sys"
  226. 403 [153]"print are you sure? defywaitprint or nwaitsys
  227. 404 gosub30:ifa$="n"then68
  228. 406 ifa$<>"y"then68
  229. 407 print"[153] press return[146][153] without an entry to exit[158]"
  230. 408 input" disk name,id[146]";hn$,id$:ifhn$=d$then68
  231. 410 open15,8,15:print#15,"new0:"+hn$+","+id$:gosub414:ifet=8then462
  232. 411 close15:goto462
  233. 412 :
  234. 414 input#15,en,em$,et,es:if(en<20)or(en=62)thenet=0:return
  235. 416 print" [150]disk error[146]"en"[157], "em$","et"[157],"es"[158]":et=8
  236. 418 print"[153] press any key[146][153] to return to menu[158]":gosub30:close5:close15:return
  237. 420 :
  238. 422 print"[147]":@"$":printtab(25)"press any key[146][153]":gosub30:return
  239. 460 :
  240. 462 print"[147][158]          disk commands menu           "
  241. 464 printtab(11)"$[153][146] disk directory
  242. 466 [153][163]11)"fprintwaitormat a blank disk
  243. 468 printtab(11)"s[153][146]cratch a seq file
  244. 470 [153][163]11)"rprintwaitename a seq file
  245. 471 printtab(11)"v[153][146]alidate a disk
  246. 472 [153][163]11)"eprintwaitxit to main menusys
  247. 474 print"       press the appropriate key       "
  248. 476 gosub30:mr$=d$:dr$=d$:ifa$="$"ora$="4"thengosub422:goto462
  249. 478 ifa$="f"then402
  250. 480 ifa$="s"thengosub498:goto488
  251. 482 ifa$="e"then68
  252. 483 ifa$="v"thengoto500
  253. 484 ifa$="r"thengosub498:goto493
  254. 486 gosub602:goto476
  255. 488 input" [153]scratch file name [158][146]";dr$:ifdr$=d$then462
  256. 490 open15,8,15:open5,8,5,"0:"+dr$+",s,r":gosub414:ifet=8then462
  257. 492 close5:print#15,"s0:"+dr$:close15:goto462
  258. 493 input" [153]rename old file [158][146]";dr$:ifdr$=d$then462
  259. 494 input" [153]    to new file [146][158]";mr$:ifmr$=d$then462
  260. 495 open15,8,15:open5,8,5,"0:"+dr$+",s,r":gosub414:ifet=8then462
  261. 496 close5:print#15,"r0:"+mr$+"="+dr$:open5,8,5:gosub414:ifet=8then462
  262. 497 close5:close15:goto462
  263. 498 print"[147][153] enter file names exactly as shown"
  264. 499 print" on the directory, ex:[158] df] mail list[158]":@"$0:*=s":return
  265. 500 print"[147]":@"$":print"[153]validate this disk? y[146][153]es or n[146][153]o":gosub30
  266. 502 ifa$<>"y"then462
  267. 504 @"v0":goto462
  268. 506 :
  269. 600 fore=0to24:poke54272+e,0:next:poke54296,15:return
  270. 602 poke54277,58:poke54278,16:poke54273,35:poke54272,134
  271. 604 poke54276,33:fore=1to100:next:poke54276,16:return
  272.