home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1986 January & February / rerun-1986-01-02.d64 / dfstructure (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  8KB  |  267 lines

  1. 4000 rem dfstructure program 1.0 - datafile utility by mike konshak (c)1985
  2. 4002 poke53281,0:poke53280,8:print"[158]"
  3. 4004 rem----dim arrays
  4. 4006 dim f$(25),t%(25),l%(25),ml$(9,4)
  5. 4008 dim f(17),c$(17,15),pc(18),tt$(5),hc$(17)
  6. 4010 fori=1to50:s$=s$+chr$(32):d$=d$+".":b$=b$+"-":nexti
  7. 4012 goto4032
  8. 4014 rem----disk error check
  9. 4016 input#15,en,em$,et,es:ifen<20oren=62thenet=0:return
  10. 4018 print" [150]disk error[146]"en"[157], "em$","et"[157],"es"[158]":et=8
  11. 4020 print" press [153]any key[158][146] to continue":gosub4026
  12. 4022 close5:close15:close4:return
  13. 4024 rem----get
  14. 4026 geta$:ifa$=""then4026
  15. 4028 return
  16. 4030 rem----opening screen
  17. 4032 print"[147]      datafile structure dump          [146]"
  18. 4034 print"   this program will read and display"
  19. 4036 print"     the structure of datafiles and"
  20. 4038 print"    printer format files created by:"
  21. 4040 print"    datafile[146] and its subprograms:"
  22. 4042 print"         dfreport[146] and dfmail[146],"
  23. 4044 print"   as well as the companion program:"
  24. 4046 print"                dfcalc[146]"
  25. 4048 print"   the datafile[146] series is written by:"
  26. 4050 print"            mike konshak"
  27. 4052 print"         4821 harvest court"
  28. 4054 print"     colorado springs, co. 80917"
  29. 4056 print"    and published in run magazine[146]"
  30. 4058 print"     press [153]any key[158][146] to continue":gosub4026
  31. 4060 rem----selection screen
  32. 4062 print"[147]   datafile or format file selection   [146]"
  33. 4064 print"      d[146]atafile record files"
  34. 4066 print"      r[146]eport format files"
  35. 4068 print"      m[146]ailing label format files"
  36. 4070 print"      c[146]alculated report format files"
  37. 4072 print"      n[146]on-datafile sequential file"
  38. 4074 print"      $[146] disk directory"
  39. 4076 print"      q[146]uit program"
  40. 4078 print"        press the appropriate key      [146]"
  41. 4080 gosub4026:k=0:ifa$="q"thenprint"[147]":end
  42. 4082 ifa$="d"thenk=1
  43. 4084 ifa$="r"thenk=2
  44. 4086 ifa$="m"thenk=3
  45. 4088 ifa$="c"thenk=4
  46. 4090 ifa$="n"thenk=5
  47. 4092 ifa$="$"then4494
  48. 4094 ifk<=0ork>5then4080
  49. 4096 rem----get name of file
  50. 4098 print" enter name of sequential file:"
  51. 4100 print" ? "nf$:input"[145] ";nf$:ifnf$=""then4062
  52. 4102 fl=0:onkgoto4106,4188,4270,4328,4416
  53. 4104 rem----read datafile seq file
  54. 4106 open15,8,15
  55. 4108 open5,8,5,"0:df] "+nf$+",s,r":gosub4016:ifet=8then4062
  56. 4110 ifen=62thengosub4018:goto4062
  57. 4112 input#5,r,f,x:gosub4016:ifet=8then4062
  58. 4114 iffl=1then4118
  59. 4116 :
  60. 4118 fori=1tof:input#5,f$(i),l%(i):nexti:gosub4016:ifet=8then4062
  61. 4120 iffl=1then4154
  62. 4122 print"[147][158]   structure of datafile  "nf$
  63. 4124 print"[158] # records possible in file "r
  64. 4126 print"[158] # records in current file  "x
  65. 4128 print"[158] # fields in each record    "f
  66. 4130 print"[158]  #   title of fields            length"
  67. 4132 fori=1tof
  68. 4134 print"[158] "i"[146]"tab(6)left$(f$(i)+d$,27)tab(33)l%(i)
  69. 4136 nexti
  70. 4138 print"[158] s[146]can records p[146]rint structure e[146]xit"
  71. 4140 gosub4026:ifa$="e"thenclose5:close15:goto4062
  72. 4142 ifa$="p"then4170
  73. 4144 ifa$="s"then4150
  74. 4146 goto4140
  75. 4148 rem----scan records
  76. 4150 print" press ctrl[146] slow f7[146] start/stop f1[146] exit":gosub4026
  77. 4152 iffl=1then4106
  78. 4154 fori=1tox:print"[158] record "i
  79. 4156 forj=1tof:input#5,rec$:print"[158] "j""rec$:nextj
  80. 4158 geta$:ifa$="[133]"then4166:rem f1
  81. 4160 ifa$="[136]"thengosub4026:rem f7
  82. 4162 nexti
  83. 4164 print"[158] press any key[146] to continue":gosub4026
  84. 4166 close5:close15:fl=1:goto4122
  85. 4168 rem----print datafile structure
  86. 4170 open4,4:print#4,"   structure for datafile ** "nf$" **"
  87. 4172 print#4,b$:print#4,"# records possible in file:"r
  88. 4174 print#4,"# records in current file :"x
  89. 4176 print#4,"# fields in each record   :"f:print#4,b$
  90. 4178 print#4," #  title of fields            length":print#4,b$
  91. 4180 fori=1tof
  92. 4182 print#4,ileft$(f$(i)+d$,27)l%(i)
  93. 4184 nexti:print#4,b$:print#4:close4:goto4122
  94. 4186 rem----read dfreport structure
  95. 4188 open15,8,15
  96. 4190 open5,8,5,"0:rp] "+nf$+",s,r":gosub4016:ifet=8then4062
  97. 4192 ifen=62thengosub4018:goto4062
  98. 4194 input#5,pw,nl,nc:gosub4016:ifet=8then4062
  99. 4196 fori=1tonl:input#5,tt$(i):nexti:gosub4016:ifet=8then4062
  100. 4198 fori=1tonc:input#5,pc(i),hc$(i)
  101. 4200 forj=1to3:input#5,ml$(i,j):nextj:nexti:gosub4016:ifet=8then4062
  102. 4202 input#5,a1$:gosub4016:ifet=8then4062
  103. 4204 close5:close15
  104. 4206 rem----display dfreport structure
  105. 4208 print"[147][158] structure of dfreport format:"nf$
  106. 4210 print"[158] # lines in report title "nl
  107. 4212 fori=1tonl:print"[158] "i;"[146]"tt$(i):nexti
  108. 4214 print"[158] # columns in report     "nc
  109. 4216 print"[158]  # pos column header      contents    "
  110. 4218 fori=1tonc
  111. 4220 print"[158] "i"[146]"tab(2)pc(i)tab(8)left$(hc$(i),18);
  112. 4222 printtab(27)"[158]fields:"ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
  113. 4224 nexti:ifa1$<>"1"then4228
  114. 4226 print"[158] column"nc"[157][158], is to be totaled":goto4230
  115. 4228 print"[158] no totaling of columns"
  116. 4230 print"[158] p[146]rint structure e[146]xit"
  117. 4232 gosub4026:ifa$="e"then4062
  118. 4234 ifa$="p"then4240
  119. 4236 goto4232
  120. 4238 rem----print dfreport structure
  121. 4240 open4,4
  122. 4242 print#4,"   structure of dfreport format ** "nf$" **"
  123. 4244 print#4,b$:print#4,"# lines in report title:"nl:print#4,b$
  124. 4246 fori=1tonl:print#4,"title"i;": "tt$(i):nexti:print#4,b$
  125. 4248 print#4,"# columns in report    :"nc:print#4,b$
  126. 4250 print#4," #  pos  header              contents":print#4,b$
  127. 4252 fori=1tonc
  128. 4254 print#4,right$(s$+str$(i),3)+right$(s$+str$(pc(i)),4);
  129. 4256 print#4,".."left$(hc$(i)+d$,20);
  130. 4258 print#4,"datafile fields:"ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
  131. 4260 nexti:print#4,b$:ifa1$<>"1"then4264
  132. 4262 print#4,"column"nc", is to be totaled":goto4266
  133. 4264 print#4,"no totaling of last column"
  134. 4266 print#4,b$:print#4:close4:goto4232
  135. 4268 rem----read dfmail structure
  136. 4270 open15,8,15
  137. 4272 open5,8,5,"0:ml] "+nf$+",s,r":gosub4016:ifet=8then4062
  138. 4274 ifen=62thengosub4018:goto4062
  139. 4276 input#5,rw:gosub4016:ifet=8then4062
  140. 4278 fori=1torw
  141. 4280 forj=1to3:input#5,ml$(i,j):nextj:nexti:gosub4016:ifet=8then4062
  142. 4282 close5:close15
  143. 4284 rem----display dfmail structure
  144. 4286 print"[147][158]  structure of dfmail format:"nf$
  145. 4288 print"[158] # rows on label  "rw
  146. 4290 print"[158]  #  contents of row (datafile fields)"
  147. 4292 fori=1torw
  148. 4294 print"[158] "i"[146]";
  149. 4296 printtab(6)ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
  150. 4298 nexti
  151. 4300 print"[158] p[146]rint structure e[146]xit"
  152. 4302 gosub4026:ifa$="e"then4062
  153. 4304 ifa$="p"then4310
  154. 4306 goto4286
  155. 4308 rem----print dfmail structure
  156. 4310 open4,4
  157. 4312 print#4,"   structure of dfmail format ** "nf$" **"
  158. 4314 print#4,b$:print#4,"# rows on label:"rw:print#4,b$
  159. 4316 print#4,"  #   contents of label (datafile fields)":print#4,b$
  160. 4318 fori=1torw
  161. 4320 print#4,right$(s$+str$(i),3)+"   "ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
  162. 4322 nexti:print#4,b$
  163. 4324 print#4:close4:goto4286
  164. 4326 rem----read dfcalc structure
  165. 4328 open15,8,15
  166. 4330 open5,8,5,"0:cr] "+nf$+",s,r":gosub4016:ifet=8then4062
  167. 4332 ifen=62thengosub4018:goto4062
  168. 4334 input#5,pw,nl,nc:gosub4016:ifet=8then4062
  169. 4336 fori=1tonl:input#5,tt$(i):nexti:gosub4016:ifet=8then4062
  170. 4338 fori=1tonc:input#5,pc(i),hc$(i)
  171. 4340 forj=0to14:input#5,c$(i,j):nextj:nexti:gosub4016:ifet=8then4062
  172. 4342 close5:close15
  173. 4344 rem----display dfcalc structure
  174. 4346 print"[147][158]   structure of dfcalc format:"nf$
  175. 4348 print"[158] # lines in report title "nl
  176. 4350 fori=1tonl:print"[158] "i;"[146]"tt$(i):nexti
  177. 4352 print"[158] # columns in report     "nc
  178. 4354 print"[158]  #  pos   header                      "
  179. 4356 fori=1tonc
  180. 4358 print"[158] "i"[146]"tab(5)pc(i)tab(10)hc$(i)
  181. 4360 nexti
  182. 4362 print"[158] press any key[146] to see more":gosub4026
  183. 4364 print"[147][158]   structure of dfcalc format:"nf$
  184. 4366 print"[158]  #  contents/equation            j eoc"
  185. 4368 fori=1tonc
  186. 4370 print"[158] "i"[146]"tab(5)c$(i,1)tab(9)c$(i,14);
  187. 4372 printtab(34)c$(i,0)tab(38)c$(i,13)
  188. 4374 nexti
  189. 4376 print"[158] s[146]ee last p[146]rint structure e[146]xit"
  190. 4378 gosub4026:ifa$="e"then4062
  191. 4380 ifa$="s"then4346
  192. 4382 ifa$="p"then4388
  193. 4384 goto4378
  194. 4386 rem----print dfcalc structure
  195. 4388 open4,4:c$=left$(b$+b$,71)
  196. 4390 print#4,"           structure of dfcalc format ** "nf$" **"
  197. 4392 print#4,c$:print#4,"# lines in report title:"nl:print#4,c$
  198. 4