home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1986 January & February
/
rerun-1986-01-02.d64
/
dfstructure
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
8KB
|
267 lines
4000 rem dfstructure program 1.0 - datafile utility by mike konshak (c)1985
4002 poke53281,0:poke53280,8:print"[158]"
4004 rem----dim arrays
4006 dim f$(25),t%(25),l%(25),ml$(9,4)
4008 dim f(17),c$(17,15),pc(18),tt$(5),hc$(17)
4010 fori=1to50:s$=s$+chr$(32):d$=d$+".":b$=b$+"-":nexti
4012 goto4032
4014 rem----disk error check
4016 input#15,en,em$,et,es:ifen<20oren=62thenet=0:return
4018 print" [150]disk error[146]"en"[157], "em$","et"[157],"es"[158]":et=8
4020 print" press [153]any key[158][146] to continue":gosub4026
4022 close5:close15:close4:return
4024 rem----get
4026 geta$:ifa$=""then4026
4028 return
4030 rem----opening screen
4032 print"[147] datafile structure dump [146]"
4034 print" this program will read and display"
4036 print" the structure of datafiles and"
4038 print" printer format files created by:"
4040 print" datafile[146] and its subprograms:"
4042 print" dfreport[146] and dfmail[146],"
4044 print" as well as the companion program:"
4046 print" dfcalc[146]"
4048 print" the datafile[146] series is written by:"
4050 print" mike konshak"
4052 print" 4821 harvest court"
4054 print" colorado springs, co. 80917"
4056 print" and published in run magazine[146]"
4058 print" press [153]any key[158][146] to continue":gosub4026
4060 rem----selection screen
4062 print"[147] datafile or format file selection [146]"
4064 print" d[146]atafile record files"
4066 print" r[146]eport format files"
4068 print" m[146]ailing label format files"
4070 print" c[146]alculated report format files"
4072 print" n[146]on-datafile sequential file"
4074 print" $[146] disk directory"
4076 print" q[146]uit program"
4078 print" press the appropriate key [146]"
4080 gosub4026:k=0:ifa$="q"thenprint"[147]":end
4082 ifa$="d"thenk=1
4084 ifa$="r"thenk=2
4086 ifa$="m"thenk=3
4088 ifa$="c"thenk=4
4090 ifa$="n"thenk=5
4092 ifa$="$"then4494
4094 ifk<=0ork>5then4080
4096 rem----get name of file
4098 print" enter name of sequential file:"
4100 print" ? "nf$:input"[145] ";nf$:ifnf$=""then4062
4102 fl=0:onkgoto4106,4188,4270,4328,4416
4104 rem----read datafile seq file
4106 open15,8,15
4108 open5,8,5,"0:df] "+nf$+",s,r":gosub4016:ifet=8then4062
4110 ifen=62thengosub4018:goto4062
4112 input#5,r,f,x:gosub4016:ifet=8then4062
4114 iffl=1then4118
4116 :
4118 fori=1tof:input#5,f$(i),l%(i):nexti:gosub4016:ifet=8then4062
4120 iffl=1then4154
4122 print"[147][158] structure of datafile "nf$
4124 print"[158] # records possible in file "r
4126 print"[158] # records in current file "x
4128 print"[158] # fields in each record "f
4130 print"[158] # title of fields length"
4132 fori=1tof
4134 print"[158] "i"[146]"tab(6)left$(f$(i)+d$,27)tab(33)l%(i)
4136 nexti
4138 print"[158] s[146]can records p[146]rint structure e[146]xit"
4140 gosub4026:ifa$="e"thenclose5:close15:goto4062
4142 ifa$="p"then4170
4144 ifa$="s"then4150
4146 goto4140
4148 rem----scan records
4150 print" press ctrl[146] slow f7[146] start/stop f1[146] exit":gosub4026
4152 iffl=1then4106
4154 fori=1tox:print"[158] record "i
4156 forj=1tof:input#5,rec$:print"[158] "j""rec$:nextj
4158 geta$:ifa$="[133]"then4166:rem f1
4160 ifa$="[136]"thengosub4026:rem f7
4162 nexti
4164 print"[158] press any key[146] to continue":gosub4026
4166 close5:close15:fl=1:goto4122
4168 rem----print datafile structure
4170 open4,4:print#4," structure for datafile ** "nf$" **"
4172 print#4,b$:print#4,"# records possible in file:"r
4174 print#4,"# records in current file :"x
4176 print#4,"# fields in each record :"f:print#4,b$
4178 print#4," # title of fields length":print#4,b$
4180 fori=1tof
4182 print#4,ileft$(f$(i)+d$,27)l%(i)
4184 nexti:print#4,b$:print#4:close4:goto4122
4186 rem----read dfreport structure
4188 open15,8,15
4190 open5,8,5,"0:rp] "+nf$+",s,r":gosub4016:ifet=8then4062
4192 ifen=62thengosub4018:goto4062
4194 input#5,pw,nl,nc:gosub4016:ifet=8then4062
4196 fori=1tonl:input#5,tt$(i):nexti:gosub4016:ifet=8then4062
4198 fori=1tonc:input#5,pc(i),hc$(i)
4200 forj=1to3:input#5,ml$(i,j):nextj:nexti:gosub4016:ifet=8then4062
4202 input#5,a1$:gosub4016:ifet=8then4062
4204 close5:close15
4206 rem----display dfreport structure
4208 print"[147][158] structure of dfreport format:"nf$
4210 print"[158] # lines in report title "nl
4212 fori=1tonl:print"[158] "i;"[146]"tt$(i):nexti
4214 print"[158] # columns in report "nc
4216 print"[158] # pos column header contents "
4218 fori=1tonc
4220 print"[158] "i"[146]"tab(2)pc(i)tab(8)left$(hc$(i),18);
4222 printtab(27)"[158]fields:"ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
4224 nexti:ifa1$<>"1"then4228
4226 print"[158] column"nc"[157][158], is to be totaled":goto4230
4228 print"[158] no totaling of columns"
4230 print"[158] p[146]rint structure e[146]xit"
4232 gosub4026:ifa$="e"then4062
4234 ifa$="p"then4240
4236 goto4232
4238 rem----print dfreport structure
4240 open4,4
4242 print#4," structure of dfreport format ** "nf$" **"
4244 print#4,b$:print#4,"# lines in report title:"nl:print#4,b$
4246 fori=1tonl:print#4,"title"i;": "tt$(i):nexti:print#4,b$
4248 print#4,"# columns in report :"nc:print#4,b$
4250 print#4," # pos header contents":print#4,b$
4252 fori=1tonc
4254 print#4,right$(s$+str$(i),3)+right$(s$+str$(pc(i)),4);
4256 print#4,".."left$(hc$(i)+d$,20);
4258 print#4,"datafile fields:"ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
4260 nexti:print#4,b$:ifa1$<>"1"then4264
4262 print#4,"column"nc", is to be totaled":goto4266
4264 print#4,"no totaling of last column"
4266 print#4,b$:print#4:close4:goto4232
4268 rem----read dfmail structure
4270 open15,8,15
4272 open5,8,5,"0:ml] "+nf$+",s,r":gosub4016:ifet=8then4062
4274 ifen=62thengosub4018:goto4062
4276 input#5,rw:gosub4016:ifet=8then4062
4278 fori=1torw
4280 forj=1to3:input#5,ml$(i,j):nextj:nexti:gosub4016:ifet=8then4062
4282 close5:close15
4284 rem----display dfmail structure
4286 print"[147][158] structure of dfmail format:"nf$
4288 print"[158] # rows on label "rw
4290 print"[158] # contents of row (datafile fields)"
4292 fori=1torw
4294 print"[158] "i"[146]";
4296 printtab(6)ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
4298 nexti
4300 print"[158] p[146]rint structure e[146]xit"
4302 gosub4026:ifa$="e"then4062
4304 ifa$="p"then4310
4306 goto4286
4308 rem----print dfmail structure
4310 open4,4
4312 print#4," structure of dfmail format ** "nf$" **"
4314 print#4,b$:print#4,"# rows on label:"rw:print#4,b$
4316 print#4," # contents of label (datafile fields)":print#4,b$
4318 fori=1torw
4320 print#4,right$(s$+str$(i),3)+" "ml$(i,1)"+"ml$(i,2)"+"ml$(i,3)
4322 nexti:print#4,b$
4324 print#4:close4:goto4286
4326 rem----read dfcalc structure
4328 open15,8,15
4330 open5,8,5,"0:cr] "+nf$+",s,r":gosub4016:ifet=8then4062
4332 ifen=62thengosub4018:goto4062
4334 input#5,pw,nl,nc:gosub4016:ifet=8then4062
4336 fori=1tonl:input#5,tt$(i):nexti:gosub4016:ifet=8then4062
4338 fori=1tonc:input#5,pc(i),hc$(i)
4340 forj=0to14:input#5,c$(i,j):nextj:nexti:gosub4016:ifet=8then4062
4342 close5:close15
4344 rem----display dfcalc structure
4346 print"[147][158] structure of dfcalc format:"nf$
4348 print"[158] # lines in report title "nl
4350 fori=1tonl:print"[158] "i;"[146]"tt$(i):nexti
4352 print"[158] # columns in report "nc
4354 print"[158] # pos header "
4356 fori=1tonc
4358 print"[158] "i"[146]"tab(5)pc(i)tab(10)hc$(i)
4360 nexti
4362 print"[158] press any key[146] to see more":gosub4026
4364 print"[147][158] structure of dfcalc format:"nf$
4366 print"[158] # contents/equation j eoc"
4368 fori=1tonc
4370 print"[158] "i"[146]"tab(5)c$(i,1)tab(9)c$(i,14);
4372 printtab(34)c$(i,0)tab(38)c$(i,13)
4374 nexti
4376 print"[158] s[146]ee last p[146]rint structure e[146]xit"
4378 gosub4026:ifa$="e"then4062
4380 ifa$="s"then4346
4382 ifa$="p"then4388
4384 goto4378
4386 rem----print dfcalc structure
4388 open4,4:c$=left$(b$+b$,71)
4390 print#4," structure of dfcalc format ** "nf$" **"
4392 print#4,c$:print#4,"# lines in report title:"nl:print#4,c$
4