home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
simtel
/
sigm
/
vols000
/
vol030
/
sigmlog.025
< prev
next >
Wrap
Text File
|
1985-02-09
|
41KB
|
740 lines
Sig/M volume 25 database seed system
multi-track system BIOS
fixed length disk sort system
print format program
(original materials from Pascal Z User Group volume 7)
-CATALOG.025 contents of Sig/M volume 25
-CATALOG.ACK acknowledgement file
ABSTRACT.025 comments on Sig/M volume 25
CRCKFILE.025 CRC of Sig/M volume 25
25.1 DATABASE.DOC 32K database seed program by Dr. Bowles
25.2 DBBUILDE.CPM 22K /
25.3 DBDEMO.CPM 1K /
25.4 DBUNIT.1 8K /
25.5 DBUNIT.2 19K /
25.6 DBUNIT.3 22K /
25.7 DBUNIT.4 17K /
25.8 DBUNIT.CPM 1K /
25.9 SGEN.COM 2K BIOS for greater than 2 system tracks
25.10 SGEN.MAC 10K /
25.11 MACROZ.MAC 18K /
25.12 CLIB.MAC 9K /
25.13 SGEN.DOC 5K /
25.14 BSORT.ASM 40K fixed length disk sort program
25.15 BSORT.COM 4K /
25.16 BSORT.NOT 4K /
25.17 PGLST.PAS 3K print format program
25.18 PGLST.COM 8K /
25.19 PGLST.NOT 1K /
25.20 W3UA.LIB 6K /
Sig/═ acknowledge≤ thσ contributioε froφ thσ Pasca∞ ┌ User≤ Grou≡ ì
iε compilinτ thσ followinτ material:
the database seed system was contributed by Dr. Bowles
the multi-track BIOS system was written by Donald Killen
thσ prin⌠ forma⌠ prograφ anΣ fixeΣ lengtΦ disδ sor⌠ systeφ werσ ì
donateΣ b∙ Genσ Duncaε oµ Pal∩ Alto¼ Ca.
CONTENTS OF VOLUME #7
Thi≤á volumσ developeΣ fas⌠ anΣ slow«á Thσ materia∞ camσ iε ì
fas⌠á bu⌠á ╔á haΣá thσ newslette≥ t∩ ge⌠á ou⌠á s∩á i⌠á wa≤á slow« ì
However¼á yo⌡ wil∞ seσ somσ ne≈ name≤ thi≤ timσ anΣ somσ origina∞ ì
ideas« Wσ havσ ß excellen⌠ star⌠ witΦ ou≥ disk≤ anΣ i⌠ i≤ easie≥ ì
t∩á prograφá witΦ sucΦ help«á Bu⌠ don'⌠ slo≈ down«á Kee≡á sendinτ ì
thosσ programs«á Iµ wσ kee≡ i⌠ up¼á thσ da∙ wil∞ comσ wheεá mos⌠ ì
an∙á modulσ wσ neeΣ wil∞ bσ availablσ FREE«á Theε programinτ wil∞ ì
be just a logical excerise and not a coding drag.
1« Thi≤ firs⌠ grou≡ i≤ thσ Dr.Bowle≤ DataBasσ seeΣ prograφ tha⌠ ì
he used in his classes. It is a frame to which a expanded
data base can be built. I have a special interest in data
base≤á anΣ ╔ aφ glaΣ tha⌠ Dr.Bowle≤ donateΣ thi≤á t∩á Publiπ ì
Domain« Thσ onσ wh∩ get≤ thi≤ converteΣ t∩ Pascal/┌ wil∞ wiε ì
ßá freσ disδ ful∞ oµ softwarσ anΣ thσ gratitudσ oµá everyonσ ì
else.
DATABASE.DOC DBBUILDE.CPM DBDEMO.CPM
DBUNIT.1 DBUNIT.2 DBUNIT.3
DBUNIT.4 DBUNIT.CPM
2«á DonalΣ Killeε ,oµ Carrolltoε Texas¼ founΣ tha⌠ a≤ hσ playeΣ ì
arounΣá witΦá hi≤ BIOS¼á hσ raε ou⌠ oµ tracδ space«á S∩á hσ ì
reworked things a bit. Now he has as much space as he wants.
That means, of course, a different SYSGEN. So this group of
program≤á arσ al∞ abou⌠ ho≈ t∩ d∩ that«á
SGEN.COM SGEN.MAC MACROZ.MAC
CLIB.MAC SGEN.DOC
3«á Genσ Duncan¼á oµ Pal∩ Alto-Ca¼ like≤ t∩ d∩ orgina∞ worδ anΣ ì
has donated the following programs. His address is listed
in Newsletter #5 and would appreciate any feedback that you
might want to pass on to him. It'll give him an idea of how
he is doing. The BSORT group is a sort program that is fast
anΣá can'⌠á bσá fooled«á Hσ give≤ somσá backgrounΣá iεá thσ ì
program so be sure to check that program. The PGLST group
is a print format program that will save paper. It reads a
tex⌠á filσá oµ fixeΣ o≥ variablσ lengtΦá characte≥á records¼ ì
eacΦ recorΣ endinτ witΦ ß C╥ anΣ LF¼á anΣ arrange≤ theφ oε ß ì
prin⌠á pagσ iε columns«á ╔ addeΣ thσ datß filσ W3U┴ t∩á sho≈ ì
you how it works, nice utility.
BSORT.ASM BSORT.COM BSORT.NOT
PGLST.PAS PGLST.COM PGLST.NOT
W3UA.LIB
-----------------------------------------------
MORE THAN TWO SYSTEM TRACKS FOR CP/M 2.2 - A PRACTICAL SOLUTION
By Donald E. Killen
For those of you out there in CP/M-land who want three (or more) system
tracks but are tired of asking "HOW", here is one way. It works in
conjunction with the program "SGEN.COM" which I have provided the Group
with.
For openers, when I found myself running out of BIOS space (CP/M 2.2 is
two sectors WORSE than good ol' 1.4 on this count), I asked myself,
"Self, how are you going to GET all the nice stuff you write in assembler
code ON a floppy, using Digital Research's SYSGEN (or a "GETSYS/
PUTSYS" combination of some sort)?" And I answered - "with difficulty".
Next, I found myself musing about compatibility with the "two-tracked"
world once I did manage to build 3 or more system tracks and use the
thing successfully. So again I said, "Self, how are you going to get
out of THAT one?" And I answered "With difficulty".
Just to show you how unreliable first impressions can be, I looked
closer at the documentation on CP/M 2.2 (As an avid non-reader of
most documentation, I did what I usually did, search for the
pictures, found none of those,and started from the back, reading
towards the front.)
About three one morning I said "AHA" - I know what I'll do - I'll fool
the system by defining (in 2.2) TWO sets of logical disk drives, and
"fold" one set over the other such that there is one set of physical
drives, each drive of which has two logical definitions, either
of which can be specified at run time.
I defined eight physical drives, 0 through 7. Drives 0,1,2, & 3
are defined just like the others execpt that three (3) tracks are
"reserved" - i.e. used for the "system", which includes my gigantic
BIOS. Drives 4,5,6, & 7 use two (2) system tracks.
Selecting drive 'A' in my system gets a 3-track drive, selecting 'E'
gets you the SAME physical drive, only it is known (to CP/M) to
have only two system tracks. Thus I can be compatible with certain
2-tracked worlds with only one drive, if I must. Or I can use up to
four drives and mix them any way I want. One EASY way to tell if you've
forgotten and selected a two-track drive which has a 3-track floppy
in it is that DIR gets you a lot of nulls or "NO FILE", depending
upon whims, etc.This works the other way around also.
Physical Drive 0 1 2 3
----------------------------------------------
3-track drive: A B C D
2-track drive: E F G H
----------------------------------------------
èThe chart above is a handy reference and serves to illustrate the
functionality of this scheme. However, one further point has to be
mentioned. Your average (e.g. Tarbell) Floppy Disk Interface can
select one of a maximum of FOUR drives. Therefore, I had to perform
minor surgery on the SELDSK routine in BIOS. Just at the point that
SELDSK is about to ship off two bits specifying which of four
drives you want, the third (hi-order, or bit 2) bit gets discarded.
Up to that point, and for that matter, in RAM until changed, are three
bits defining the LOGICAL drive requested. That accesses the tables
(in CP/M 2.2) which define the disk parameters. Then, for the purposes
of limited controllers (like the Tarbell Single Density controller), only
the least significant two bits are used - hence a 4 looks like a 0,
a 5 like a 1, and so-forth.
If anyone is really interested in the gory details, Charlie Foster has
a disk with a copy of my BIOS (KBIOS.MAC/PRN) - which might convey
the details in more depth.
Oncσá CP/═á ha≤á thi≤ capability¼á ╔ nex⌠ needeΣá t∩á refinσá thσ prograφá
╔á cal∞á SGE╬á «á SGEN.CO═á wil∞á d∩á anythinτá Digita∞ Research'≤ SYSGE╬
wil∞ do¼ plu≤ i⌠ i≤ aε "n-trackó systeφ iε tha⌠ i⌠á ask≤ yo⌡ u≡ fron⌠ ho≈
man∙ track≤ (systeφ tracks⌐ yo⌡ wan⌠ t∩ copy«á I⌠ work≤ witΦ 1-╣ track≤
(NOTE║á Iµ anyonσ come≤ u≡ witΦ ß one-tracδ system¼ le⌠ mσ know¼ o.k.)«
I⌠ make≤ yo⌡ sa∙ "yó (o≥ "Y"⌐á t∩á makσ doubl∙ sure¼á theε copie≤ froφ
memor∙ o≥á disδá t∩ memor∙ o≥ disk - just like SYSGEN. You'll also need
the upgraded versions of MACRO.LIB, which, after converting nearly
everything to Zilog notation, is called MACROZ.MAC, and I beleive CLIB.MAC
is also used. The latter is a clutter of miscellany which I've put together
for assembly development work.
I have no idea what one would do with regard to defining drives "sort of"
like the above only for CP/M 1.4 - but I'd like to hear any
comments anyone has.
------------------------------------------------
EDITOR'╙á NOTE║á Doε Killeε i≤ willinτ t∩ discus≤ thi≤á (o≥á an∙ ì
othe≥áá item≤á oµá interest⌐á witΦá anyonσá bu⌠ ì
prefer≤á ßá notσá iε thσá mai∞á howeve≥áhe ì
doesn't really mind the phone at all. So----
Donald Killen
2101 Hickory Drive home: (214) 242-4968
Carrollton, Tx
75006
(************************************************************)
:
: A gentlemen down south was kind enough to send me this
: copy of Dr Bowles database seed. It was in UCSD format
: so I had to spend several days in cleaning it up. But
: its done now so I am passing this program on to those who
: may be interested. The units are still in UCSD BUT by putting
: them in circulation among the membership of Pascal/Z
: we'll chip away at it until we have it converted and
: boy! won't that be a program.
:
************************************************************)
{EE&CS 63 Database Homework Project}
12 February, 1980
K.L.Bowles
AssigneΣá homeworδá fo≥ thσ remainde≥ oµá thσá quarte≥á wil∞ ì
consis⌠áá oµáá carryinτá ou⌠áá one¼áá two¼áá o≥áá threσáá prograφ ì
design/implementatioε project≤ dependinτ upoε whethe≥ yo⌡ plaε t∩ ì
earε ß coursσ gradσ of'C'¼á 'B'¼á or'Aº respectively«á Al∞ oµ thσ ì
project≤á wil∞á involvσá makinτ change≤ iε ß starte≥á prograφá oµ ì
mediuφ complexity«á Thσ starte≥ prograφ i≤ ß partiall∙á completeΣ ì
databasσ manager¼ thσ desigε oµ whicΦ ha≤ beeε discusseΣ iε EE&C╙ ì
6│ lecture≤ fo≥ thσ las⌠ week¼ anΣ wil∞ bσ thσ principa∞ topiπ oµ ì
the remaininτ lecture≤ for the course.
1. {Objectives}
Practica∞ usσ oµ database≤ typicall∙ require≤ morσ extensivσ ì
programminτá thaε caε reasonabl∙ bσ requireΣ fo≥ homeworδ froφá ß ì
clas≤á a⌠á thσ leve∞ oµ EE&C╙á 63«á Nevertheless¼á onσá importan⌠ ì
objectivσá oµá thσ coursσ i≤ t∩ preparσ student≤ fo≥ thσ kinΣá oµ ì
workinτ environmen⌠ the∙ ma∙ encounte≥ upoε takinτ job≤ a≤á (non-ì
numerical⌐áá programmer≤á afte≥á leavinτá UCSD«áá Worδá witΦá thσ ì
databasσá starte≥ prograφ provideΣ witΦ thi≤ coursσ wil∞ hel≡á t∩ ì
prepare you in several ways:
a⌐ Thσ bes⌠ wa∙ t∩ develo≡ ß largσ prograφ i≤ t∩ proceeΣ iε eas∙ ì
stages¼á addinτ facilitie≤ anΣ debugginτ theφ a⌠ eacΦ stage« Thi≤ ì
methoΣá i≤á ofteεá calleΣá "step-wisσá refinement"«á Thσá starte≥ ì
prograφ wil∞ givσ yo⌡ ß realistiπ basσ froφ whicΦ t∩ star⌠á work¼ ì
anΣá wil∞ allo≈ gettinτ significan⌠ result≤ withou⌠ goinτ througΦ ì
thσ morσ difficul⌠ firs⌠ ste≡ oµ establishinτ thσ overal∞á desigε ì
of an eventual program system.
b⌐ Iε workinτ witΦ largσ programs¼ thσ stylσ useΣ iε writinτ thσ ì
program≤á become≤á increasingl∙ important«á Thσ stylσ issue≤á arσ ì
difficul⌠á t∩ teacΦ usinτ shor⌠ quizze≤ anΣ homeworδá assignment≤ ì
a≤ iε EE&C╙ 61« Yo⌡ shoulΣ spenΣ enougΦ timσ readinτ anΣ studyinτ ì
thσá starte≥á program¼á anΣá associateΣá librarie≤á oµá routines¼ ì
provideΣá t∩ yo⌡ tha⌠ yo⌡ havσ ß gooΣ understandinτ oµá ho≈á the∙ ì
work«á A≤ yo⌡ d∩ this¼ noticσ thσ treatmen⌠ giveε t∩ stylσ issue≤ ì
sucΦá a≤á indentatioε (a≤ ß substitutσ fo≥á structurσá diagrams)¼ ì
relativσá brevit∙ oµ procedure≤ anΣ functions¼á usσ oµ CONS╘á anΣ ì
TYP┼ declarations¼á anΣ handlinτ oµ erro≥ conditions« ExperienceΣ ìèprogrammer≤á ofteε learε morσ abou⌠ ho≈ t∩ usσ ß ne≈á programminτ ì
languagσá o≥ compute≥ systeφ froφ readinτ largσ program≤á writteε ì
b∙á other≤á thaεá froφá extensivσá amount≤á oµá writteεá tex⌠á o≥ ì
lectures.
c⌐á ┴ databasσ prograφ i≤ generall∙ useΣ ove≥ aε extendeΣ perioΣ ì
oµá time¼á anΣá usuall∙á evolve≤á froφá it≤á initia∞á performancσ ì
specification≤ int∩ ß changeΣ o≥ expandeΣ wholσ a≤ timσ goe≤á on« ì
Iεá man∙á cases¼á thσ initia∞ prograφ i≤ largσ enougΦ t∩á requirσ ì
severa∞ programmer≤ t∩ bσ employeΣ t∩ completσ separatσ part≤á oµ ì
thσ program« Fo≥ botΦ oµ thesσ reasons¼ i⌠ i≤ ver∙ importan⌠ tha⌠ ì
method≤ bσ useΣ t∩ simplif∙ thσ problem≤ oµ ß programme≥ assigneΣ ì
t∩á modif∙ o≥ {maintain² ß prograφ previousl∙ createΣ b∙á others« ì
Thi≤á require≤ tha⌠ gooΣ specificatioε anΣ maintenancσá document≤ ì
bσá writteε t∩ g∩ witΦ thσ program¼á anΣ tha⌠ ß reasonablσ numbe≥ ì
oµá comment≤ bσ embeddeΣ iε thσ prograφ t∩ assis⌠ onσá programme≥ ì
t∩ reaΣ anΣ understanΣ thσ worδ oµ another«á Worδ witΦ thσá EE&C╙ ì
6│á databasσá prograφá b∙ thσ clas≤ wil∞ requirσá tha⌠á differen⌠ ì
team≤á oµá student≤á exchangσ documentatioεá anΣá program≤á whicΦ ì
refinσ thσ starte≥ prograφ iε differinτ ways« Thi≤ shoulΣ providσ ì
ß moderatel∙ realistiπ simulatioε oµ thσ rea∞ worlΣ oµ worδá witΦ ì
large programs outside the University.
{Organization}
Thσ complexit∙ oµ thσ worδ needeΣ t∩ completσ thσ desigε anΣ ì
implementatioεá iεá an∙á oµá thσ topiπ area≤á describeΣá herσá i≤ ì
to∩á greaa⌠ t∩ expec⌠ an∙ homeworδ teaφ iε EE&C╙ 6│ t∩ carr∙á thσ ì
worδ iε ß topiπ areß t∩ completion«á However¼ i⌠ wil∞ bσ possiblσ ì
t∩á makσá significan⌠á performancσ improvement≤á iεá thσá prograφ ì
withiεá roughl∙ thσ amoun⌠ oµ timσ ß teaφ shoulΣ expec⌠ t∩á spenΣ ì
on homework in a two-week period.
Thσá methoΣ oµ operatioε wil∞ requirσ tha⌠ ßá homeworδá teaφ ì
writσ specification≤ oε ß proposeΣ changσ t∩ thσ starte≥ program« ì
Thesσá specification≤á wil∞á bσá discusseΣá witΦá Prof«áá Bowles¼ ì
RicharΣá Kaufmann¼á o≥á iεá somσ case≤á witΦá ßá proctor¼á beforσ ì
proceedinτá t∩á writσ anΣ debuτ thσ prograφá change≤á themselves« ì
Student≤ wh∩ carr∙ ou⌠ thσ programminτ change≤ beforσ writinτ thσ ì
specification≤á shoulΣá bσ awarσ tha⌠ thosσ change≤ wil∞ onl∙á bσ ì
regardeΣá a≤á experimenta∞á anΣá onl∙á usefu∞á fo≥á writinτáá thσ ì
specificcation«á Iεá general¼á thσ specification≤ wil∞ havσ t∩ bσ ì
approveΣ first¼á a≤ thσ firs⌠ ste≡ iε completinτ ß homeworδá set« ì
Yo⌡á shoulΣ expec⌠ t∩ bσ requesteΣ t∩ changσ you≥á specification≤ ì
iεá significan⌠ way≤ beforσ proceedinτ t∩ implemen⌠ you≥á prograφ ì
changes«á Thu≤á i⌠á i≤ possiblσ tha⌠ prograφ change≤ madσ iεá thσ ì
coursσá oµá decidinτ ho≈ t∩ writσ thσ specification≤á wil∞á servσ ì
onl∙á a≤á ß learninτ experience¼á anΣ ma∙ no⌠á bσá acceptablσá iε ì
completion of a homework set.
EacΦá se⌠á oµá specification≤ shoulΣ contaiεá a⌠á leas⌠á thσ ì
following parts:
a⌐á ┴á statemen⌠á oµá thσá objective≤ oµ thσá worδá yo⌡á plaεá t∩ ì
undertake.
b⌐á ┴á statemen⌠ oµ thσ methoΣ yo⌡ plaε t∩ usσ iεá reachinτá you≥ ì
objectives«á ┴ diagraφ o≥ tw∩ ma∙ provσ usefu∞ iε explaininτ you≥ ì
method.
c⌐á ┴ rougΦ descriptioε oµ thσ addition≤ o≥ change≤ yo⌡á plaεá t∩ ìèmakσá t∩á thσá starte≥ program«á Thi≤ ma∙á includσá heading≤á anΣ ì
paramete≥ declaration≤ oµ somσ oµ thσ procedure≤ and/o≥ function≤ ì
yo⌡áá proposσá t∩á use«áá I⌠á woulΣá typicall∙á includσá ßá brieµ ì
descriptioεá oµ thσ rolσ eacΦ importan⌠ procedurσ o≥ functioεá i≤ ì
expected to play.
d⌐á ┴á listinτ oµ thσ parameter≤ yo⌡ expec⌠ t∩á use¼á alonτá witΦ ì
maximuφá anΣ minimuφ value≤ o≥ othe≥ statemen⌠ oµ thσ specia∞á o≥ ì
limiting values each parameter may take on.
e⌐á ┴ statemen⌠ oµ ho≈ yo⌡ plaε t∩ tes⌠ you≥ prograφá change≤á t∩ ì
verif∙á tha⌠á the∙á iε fac⌠ operatσ a≤ planneΣ oncσá writteεá anΣ ì
compiled«á Fo≥á thσ typica∞ homeworδ problem¼á thσ lengtΦ oµá thσ ì
specification≤ ma∙ ruε froφ onσ t∩ abou⌠ threσ pages«á T∩ havσá ß ì
se⌠ oµ specification≤ accepteΣ fo≥ gradinτ purposes¼á bσ prepareΣ ì
t∩ defenΣ thσ desigε choice≤ yo⌡ proposσ t∩ use« EacΦ membe≥ oµ ß ì
homeworδá teaφ mus⌠ bσ familia≥ witΦ al∞ aspect≤ oµ thσ worδ tha⌠ ì
thσá teaφá propose≤ t∩ takσ on«á Iµ yo⌡ spli⌠ u≡ thσ worδá t∩á bσ ì
handleΣ separatel∙ b∙ differen⌠ teaφ members¼á yo⌡ shoulΣá defenΣ ì
you≥á owεá worδ t∩ thσ othe≥ teaφ member≤ beforσ submittinτá you≥ ì
worδá fo≥á forma∞ acceptance«á Otherwisσ therσ i≤ n∩á purposσá iε ì
workinτá a≤ ß team¼á anΣ yo⌡ shoulΣ bσ defendinτ you≥á individua∞ ì
worδ separatel∙ fo≥ grading« Fo≥ forma∞ grading¼ neatnes≤ wil∞ bσ ì
importan⌠á (bu⌠á yo⌡ don'⌠ neeΣ t∩ ge⌠ carrieΣ awa∙ anΣá spenΣá ß ì
largσá par⌠ oµ you≥ timσ jus⌠ iε makinτ you≥ worδ neat)«á Iµá thσ ì
writteε specificatioε i≤ aε unreadablσ mess¼ yo⌡ wil∞ bσ askeΣ t∩ ì
re-d∩á i⌠á beforσá i⌠ caε bσ considereΣá fo≥á acceptance«á T∩á bσ ì
accepteΣá fo≥ gradinτ purposes¼á eacΦ specificatioεá documen⌠á o≥ ì
prograφá submitteΣá mus⌠á contaiε thσ name≤ oµá al∞á person≤á wh∩ ì
workeΣá oεá it¼á anΣ thσ approximatσ datσ oε whicΦ thσá worδá wa≤ ì
carrieΣ out« Iε programs¼ thesσ shoulΣ bσ iε thσ forφ oµ comment≤ ì
a⌠á thσá heaΣ oµ ß listing¼á o≥ iε standardizeΣ initial≤ sucΦá a≤ ì
(*KLB*⌐á embeddeΣá iεá ß prograφá wherσá yo⌡á makσá changes«á Thσ ì
initial≤á caεá bσ useΣ witΦ thσ Editor'≤ F(inΣ commanΣ t∩á locatσ ì
changes made by each of several individuals.
{General Description of the Starter Program}
Thσá packagσ oµ prograφ listing≤ passeΣ ou⌠ t∩ thσ clas≤á oε ì
1▒ February contains four sections, as follows:
a) Program DBTEST - pages 1 .. 4
b) Unit DBUNIT - begins on page 5
c) Unit SCUNIT - begins on page 41
d) Unit STARTER - begins on page 46
Al∞á threσ unit≤ arσ useΣ b∙ thσ DBTES╘ program¼á whicΦá ha≤ ì
onl∙á ßá maiε prograφ bod∙ runninτ froφ linσ 21╡ t∩ linσá 23┤á oε ì
pagσ 4«á Thσ USE╙ statemen⌠ oε linσ 21│ oµ thσ listinτ occur≤á iε ì
thσá prograφá sourcσ filσ immediatel∙ afte≥ thσá PROGRA═á headinτ ì
linσ (linσ │ iε thσ listing)« Al∞ oµ thσ interveninτ line≤ iε thσ ì
DBTES╘ listinτ arσ froφ thσ INTERFAC┼ part≤ oµ thσ unit≤ nameΣ iε ì
thσá USE╙á statement.Iεá UCS─ Pascal¼á ß Uni⌠ ha≤á thσá followinτ ì
form:
UNIT XYZ;
INTERFACE
CONST
...
TYPE
...
VARè...
PROCEDURE & FUNCTION headings
IMPLEMENTATION
CONST
...
TYPE
...
VAR
...
PROCEDURE & FUNCTION declarations
Al∞ oµ thσ declareΣ object≤ arσ simila≥ iε purposσ t∩á thosσ ì
iε aε ordinar∙ Pasca∞ program«á Object≤ declareΣ iε thσ INTERFAC┼ ì
par⌠ arσ intendeΣ t∩ bσ useΣ b∙ program≤ o≥ othe≥ unit≤ whicΦ usσ ì
thσá Uni⌠ XY┌ (o≥ whateve≥ namσ yo⌡ choose)«á Object≤ declareΣ iε ì
thσá IMPLEMENTATIO╬á par⌠ generall∙ ma∙ no⌠ bσ useΣá directl∙á b∙ ì
usinτá prograφá o≥á units«á Howeve≥ thσá procedurσá anΣá functioε ì
heading≤ iε thσ INTERFAC┼ par⌠ servσ a≤ thσ equivalen⌠ oµ FORWAR─ ì
declaration≤áá matcheΣáá b∙á completeΣá procedurσáá o≥áá functioε ì
declaration≤ iε thσ IMPLEMENTATIO╬ part« Procedure≤ anΣ function≤ ì
declareΣá onl∙ iε thσ IMPLEMENTATIO╬ par⌠ ma∙ bσ calleΣá onl∙á b∙ ì
other procedures and functions, not by a using program.
Thσá prograφá listinτ fo≥ thσ DBTES╘ prograφ duplicate≤á thσ ì
INTERFAC┼ part≤ oµ al∞ threσ oµ thσ Unit≤ tha⌠ i⌠ uses«á Line≤á ╡ ì
througΦá 12╢ arσ thσ interfacσ fo≥ thσ DBUNIT¼á line≤ 13░ througΦ ì
14╖á arσ fo≥ thσ SCUNIT¼á anΣ line≤ 15░ througΦ 21▓ arσá fo≥á thσ ì
STARTE╥á unit«á Thσá STARTE╥á uni⌠ encompasse≤ thσá bulδá oµá thσ ì
origina∞ conten⌠ oµ thσ DBTES╘ prograφ itself¼á anΣ i⌠ represent≤ ì
onl∙á aε approximatioε t∩ thσ librar∙ oµ primitivσ routine≤á tha⌠ ì
migh⌠á bσ useΣ fo≥ ß full∙ developeΣ databasσ system«á B∙ placinτ ì
functioninτ part≤ oµ thσ DBTES╘ prograφ iε thσ STARTE╥á unit¼á i⌠ ì
ha≤á beeεá possiblσá t∩á reducσ thσ sizσá oµá ßá typica∞á prograφ ì
compilattioεá fo≥á thσá clas≤ t∩ ß smal∞ anΣá readil∙á manageablσ ì
size.A≤á ma∙ bσ seeε froφ line≤ 21╡ througΦ 23┤ oεá pagσá 4¼á thσ ì
DBTES╘á prograφ i≤ basicall∙ quitσ simple«á First¼á thσ procedurσ ì
STINITIALIZ┼ i≤ called«á Detail≤ oε STINITIALIZ┼ ma∙ bσ founΣá iε ì
thσá listinτ fo≥ thσ STARTE╥ uni⌠ oε pagσ 48¼á line≤ 27╢á througΦ ì
305«á Fo≥ mos⌠ purposes¼á thσ procedurσ operate≤ jus⌠ a≤ i⌠ woulΣ ì
havσá haΣ i⌠ beeε haΣ i⌠ beeε declareΣ iε ful∞ withiε thσá DBTES╘ ì
program«á Continuinτ iε DBTES╘ (pagσ 4)¼ thσ prograφ loop≤ iε thσ ì
REPEA╘á statemen⌠ unti∞ DON┼ i≤ set«á DON┼ i≤ ß Booleaεá variablσ ì
declareΣ iε thσ INTERFAC┼ par⌠ oµ STARTER¼ a≤ ma∙ bσ seeε a⌠ linσ ì
19▓ oε pagσ 4¼á o≥ linσ 19▓ oε pagσ 46«á GOTOX┘ (linσ 21╕ oε pagσ ì
4⌐ i≤ ß built-iε procedurσ provideΣ b∙ thσ UCS─ Pasca∞ system« I⌠ ì
cause≤ thσ curso≥ t∩ jum≡ t∩ thσ (column¼ row⌐ locatioε indicateΣ ì
b∙á thσá paramete≥á expression≤á (typσá Integer)«á Thσá function≤ ì
GETCOMMAN─á anΣ CHANGEREC¼á anΣ thσ procedure≤ SAVEREC¼á FINDREC¼ ì
GETREC¼á anΣá NEWRE├ arσ al∞ declareΣ iε thσá STARTE╥á unit«á Thσ ì
procedurσá DBSHOWER╥ i≤ declareΣ iε thσ DBUNIT«á Iε general¼á yo⌡ ì
caεá identif∙á routine≤á declareΣ iε thσá databasσá suppor⌠á uni⌠ ì
DBUNI╘ b∙ thσ prefi° "DB"¼á anΣ thosσ iε thσ screeε contro∞á uni⌠ ì
SCUNI╘ b∙ thσ prefix "SC".
Fo≥á lacδ oµ time¼á i⌠ wil∞ no⌠ bσ possiblσ t∩ distributσá ß ì
ful∞á se⌠ oµ writteε description≤ oµ thσ routine≤ iε thσ program≤ ì
distributed«á Whilσá i⌠á wa≤ planneΣ t∩ providσ yo⌡ witΦá ßá morσ ì
comprehensivσá writteε description¼á thσ leve∞á oµá documentatioε ì
provideΣá herσ i≤ probabl∙ typica∞ oµ documentatioε yo⌡ ma∙á havσ ì
t∩á copσ witΦ iε rea∞ worlΣ programminτ assignments«á Iε general¼ ì
mos⌠á importan⌠á routine≤á havσ brieµ comment≤ oεá wha⌠á the∙á d∩ ìèimmediatel∙ followinτ theΘ headinτ lines«á Virtuall∙ al∞ routine≤ ì
havσ beeε giveε name≤ whicΦ directl∙ sugges⌠ wha⌠ the∙ do«á Afte≥ ì
ß brieµ descriptioε oµ thσ datß structurσ useΣ b∙ thσ system¼á wσ ì
wil∞ walδ yo⌡ througΦ onσ oµ thσ STARTE╥ procedure≤ t∩ assis⌠á iε ì
readinτ thσ programs.
{The Data Structure and DataBase Support Module DBUNIT}
Thσá genera∞ concep⌠ oµ softwarσ tool≤ i≤ describeΣá briefl∙ ì
iεá thσ Beginner≤ Manua∞ fo≥ thσ UCS─ Pasca∞ System¼á chapte≥á 9« ì
DBUNI╘á ha≤ beeε designeΣ witΦ thσ inten⌠ t∩ providσ ß librar∙ oµ ì
primitivσá softwarσá tool≤ t∩ simplif∙ writinτá databasσá handle≥ ì
program≤á fo≥á ßá variet∙ oµá purposes«á Thσá datßá structurσá i≤ ì
intendeΣá t∩á overcomσ tw∩ bothersomσ limitation≤ oµá thσá Pasca∞ ì
language¼áá anΣá typica∞á smal∞á operatinτá systems¼áá fo≥á thesσ ì
purposes:
a⌐á Thσ Pasca∞ requiremen⌠ t∩ usσ record≤ oµ fixeΣ sizσ lead≤á t∩ ì
inefficien⌠á usσá oµ storagσ spacσ iµ al∞ record≤ arσá storeΣá iε ì
conventiona∞ Pasca∞ files« T∩ accoun⌠ fo≥ name≤ o≥ othe≥ variablσ ì
sizσá object≤á oµá maximuφ length¼á mos⌠ record≤á contaiεá wasteΣ ì
space«á Oεá average¼á ß typica∞ filσ migh⌠ contaiε froφ 5░ t∩á 7╡ ì
percen⌠á wasteΣá space«á Thσ datß structurσá implementeΣá iεá thσ ì
DBUNI╘ overcome≤ thi≤ b∙ providinτ randoφ acces≤ t∩ variablσ sizσ ì
objects. The cost is a small amount of access overhead.
b⌐á ┴á typica∞á databasσ contain≤ severa∞á relateΣá bu⌠á distinc⌠ ì
files¼á eacΦ witΦ it≤ owε distinc⌠ recorΣ format(s)«á Maintenancσ ì
oµ thesσ files¼ anΣ thσ spacσ eacΦ filσ occupies¼ caε becomσ ver∙ ì
awkward«á Thσ DBUNI╘ baseΣ systeφ overcome≤ thi≤ b∙ interminglinτ ì
al∞á oµá thσ logica∞ datß sequences¼á tha⌠ otherwisσ woulΣ bσá iε ì
separatσá files¼á iεá onσ UCS─ Pasca∞ file«á Thσá datßá structurσ ì
provide≤á packinτ oµ variablσ sizσ datß object≤ b∙á usinτá linkeΣ ì
lists«á I⌠á provide≤á reasonabl∙á rapiΣ randoφá acces≤á t∩á thosσ ì
object≤á b∙á breakinτá thσ databasσ filσ int∩á "pages"«á Iεá thi≤ ì
system¼á ß pagσ i≤ treateΣ a≤ ß mediuφ sizσ physica∞ recorΣ largσ ì
enougΦ t∩ holΣ man∙ logica∞ record≤ oµ variablσ size«á ┴ CONSTan⌠ ì
iεá thσá DBUNI╘á establishe≤ thσ pagσ sizσá a≤á 409╢á bytes¼á thσ ì
equivalent⌠ oµ ╕ block≤ oµ 51▓ byte≤ each«á Thi≤ coulΣ bσ changeΣ ì
iµá onσá wisheΣ b∙ recompilinτ thσ unit«á Thσ DBUNI╘á allow≤á fo≥ ì
manipulatinτá thσá conten⌠ oµ ß pagσ b∙ loadinτ i⌠á int∩á an∙á oµ ì
severa∞á "workareasóá whicΦ caε bσ "openedó fo≥ usσ b∙á primitivσ ì
routine≤á provideΣ witΦ thσ unit«á Datß caε bσ extracteΣá iεá onσ ì
workareßá anΣ moveΣ t∩ anothe≥ workareß o≥ t∩ thσ usinτá program« ì
Datßá caεá bσ editeΣ (b∙ procedurσ anΣ functioε calls⌐á withiεá ß ì
workarea¼á anΣá late≥á inserteΣ int∩ anothe≥ workarea«á Wheεá thσ ì
content≤á oµ ß full-pagσ workareß i≤ read∙ t∩ bσ saveΣá agaiεá oε ì
thσá disk¼á tha⌠ caε bσ donσ usinτ thσ DBPUTPAG┼á function«á Wheε ì
opened¼á ßá workareß ma∙ bσ a≤ largσ a≤ ß ful∞ page¼á o≥á smalle≥ ì
dependinτ upoε thσ programmer≤ requirement≤ fo≥ temporar∙ workinτ ì
storagσá iεá memory«á Withiε ß page¼á thσ datß structurσá caεá bσ ì
describeΣ witΦ thσ hel≡ oµ figure≤ 1¼á ▓ anΣ 3«á Figurσ ▒ show≤ ß ì
pagσá containinτá severa∞ "groups"«á Iε thi≤ system¼á ß grou≡á i≤ ì
equivalen⌠á t∩ ß "repeatinτ group"¼á a≤ ofteε referreΣ t∩ iεá thσ ì
databasσá industry«á I⌠ i≤ ß structurσ whicΦ contain≤ ßá variablσ ì
numbe≥á oµá records«á Record≤ arσ simila≥ iεá concep⌠á t∩á Pasca∞ ìèrecords¼ excep⌠ tha⌠ thσ field≤ iε ß recorΣ iε thi≤ systeφ ma∙ bσ ì
oµ variablσ size«á Thσ relationship≤ amonτ groups¼á records¼á anΣ ì
field≤ arσ showε iε Figurσ 2« ┴ grou≡ start≤ witΦ ß linδ pointinτ ì
t∩á thσá beginninτ oµ thσ followinτ group¼á o≥ t∩ thσ enΣ oµá thσ ì
lis⌠ (indicateΣ b∙ ß linδ valuσ oµ 0)«á Withiε ß group¼ therσ arσ ì
severa∞ records¼ eacΦ oµ whicΦ start≤ witΦ ß linδ pointinτ t∩ thσ ì
nex⌠á record«á Withiε ß record¼á therσ arσá severa∞á fields«á Al∞ ì
variablσá field≤ star⌠ witΦ ß linδ pointinτ t∩ thσ nex⌠ field«á ┴ ì
recorΣ ma∙ contaiε onσ o≥ morσ unlinkeΣ field≤ oµ fixeΣ size« Al∞ ì
fixeΣ sizσ field≤ arσ lumpeΣ int∩ ß singlσ linkeΣ pseudo-fielΣ a⌠ ì
thσá beginninτá oµá thσ record«á Thσ fixeΣá field≤á arσá accesseΣ ì
relativσ t∩ thσ positioε oµ thσ linδ whicΦ make≤ thσ pseudo-fielΣ ì
appea≥ simila≥ t∩ othe≥ field≤ withiε thσ linkeΣ lis⌠á structure« ì
┴ fielΣ ma∙ bσ defineΣ t∩ contaiε ß group«á Thu≤ thσ structurσ i≤ ì
recursive¼ anΣ ma∙ contaiε man∙ level≤ oµ nesteΣ groups¼ records¼ ì
anΣ field≤ in applications where that makes sense. Thσ forma⌠ oµ al∞ groups¼á records¼á anΣ field≤ i≤ unde≥ thσ ì
contro∞á oµá "descriptoró record≤ storeΣ iε threσ group≤á a⌠á thσ ì
beginninτ oµ thσ databasσ file«á Iε thσ filσ TESTD┬ tha⌠ yo⌡ wil∞ ì
bσ using¼á al∞ threσ list≤ oµ descriptor≤ arσ containeΣ iε Pagσ ú ì
0« Group≤ arσ iε predefineΣ descripto≥ grou≡ #1¼ record≤ iε grou≡ ì
#2¼á anΣ field≤ iε grou≡ #3«á ┴ grou≡ descripto≥ refer≤ t∩ onσ o≥ ì
morσá numbereΣ descriptor≤ fo≥ thσ record≤ i⌠ contains«á ┴ recorΣ ì
descripto≥ contain≤ ß simplσ (unlinked⌐ lis⌠ oµá field-descripto≥ ì
numbers«á ┴ fielΣ descripto≥ referrinτ t∩ ß nesteΣ grou≡ contain≤ ì
thσ descripto≥ numbe≥ oµ tha⌠ group¼á rathe≥ thaε ß specificatioε ì
oµ thσ typσ of information contained in the field.
Figurσá │á show≤ ß closσ approximatioε t∩ thσá relationship≤ ì
amonτ thσ descriptor≤ iε thσ TESTD┬ filσ whicΦ yo⌡ wil∞ bσá usinτ ì
fo≥á thi≤ course«á A≤ ma∙ bσ seen¼á Grou≡ #░ (thσ "People_Group"⌐ ì
refer≤á t∩á jus⌠á onσá recorΣá descripto≥á fo≥á RecorΣá #░áá (thσ ì
"Person_Rec")«á RecorΣ #0¼á iε turn¼á refer≤ t∩ fielΣ descriptor≤ ì
numbereΣ ░ througΦ 10«á Field≤ 0¼ 1¼ anΣ ▓ arσ fixeΣ sizσ intege≥ ì
fields¼á anΣ eacΦ i≤ ▓ byte≤ wide«á Field≤ ┤ througΦ ╣ arσ strinτ ì
typσáá fields¼áá witΦá maximuφá width≤á ranginτá froφá 1╡á t∩á 4░ ì
characters«á FielΣá #1░á refer≤ t∩ Grou≡ #▓á (thσá "TransGroup")¼ ì
whicΦ iε turε contain≤ record≤ witΦ threσ fixeΣ sizσ field≤ each« ì
Thσá notatioε "SWó refer≤ t∩ ß bytσ storeΣ witΦá eacΦá descripto≥ ì
containinτá contro∞á bits«á Mos⌠á oµ thσ contro∞á bit≤á arσá lef⌠ ì
undefineΣ fo≥ possiblσ usσ iε ß user'≤ program«á Fo≥ fields¼á bi⌠ ì
#▒á (correspondinτ t∩ thσ valuσ 2⌐ indicate≤ ß fixeΣ widtΦ field« ì
Thσ notation≤ "Row"¼á "Lcol"¼á anΣ "Dcoló arσ fo≥ controllinτ thσ ì
screeε locatioε anΣ forma⌠ oµ datß display«á BotΦ thσ "labeló anΣ ì
thσá datß conten⌠ oµ ß fielΣ arσ t∩ bσ displayeΣ iε thσ samσá ro≈ ì
oεá thσá screeεá (numberinτ ░ a⌠ thσ to≡ t∩ 2│á a⌠á thσá bottom)« ì
"Lcoló indicate≤ thσ columε numbe≥ iε whicΦ thσ field'≤ labe∞á i≤ ì
t∩ bσ started« "Dcoló indicate≤ thσ columε iε whicΦ thσ left-mos⌠ ì
datßá characte≥ shoulΣ appear«á Thσ descriptor≤ arσ storeΣ iε thσ ì
TESTD┬á filσ a≤ linkeΣ list≤ simila≥ iε concep⌠ t∩ thosσá iεá thσ ì
list≤ the∙ describe«á Thσ descriptor≤ arσ storeΣ iε thσ file¼ anΣ ì
edited¼á usinτá thσá samσ primitivσ operation≤ tha⌠ appl∙ t∩á thσ ì
datßá the∙á describe«á However¼á acces≤á t∩á thσá descriptor≤á i≤ ì
accomplisheΣ witΦ thσ globa∞ Booleaε DBTYPECHEC╦ (linσ 4┤ oε pagσ ì
▒á oµ thσ listing⌐ se⌠ t∩ FALSE«á Thi≤ suppresse≤á reference≤á t∩ ì
descriptor≤á wheεá movinτá arounΣ iεá thσá groups¼á records¼á anΣ ì
fields«á InsteaΣá thσ descriptor≤ arσ considereΣ b∙ DBUNI╘ itselµ ìèa≤ madσ u≡ oµ simplσ linkeΣ strings« Thesσ arσ passeΣ t∩ thσ datß ì
structurσá edito≥á program«á Thσ datßá structurσá edito≥á prograφ ì
currentl∙ availablσ i≤ quitσ primitive¼ anΣ supplieΣ t∩ thσ clas≤ ì
a≤á par⌠á oµá thσá prograφ DBUILDER«á DBUILDE╥á i≤á basicall∙á aε ì
experimenta∞ laborator∙ designeΣ t∩ allo≈ step-by-ste≡á debugginτ ì
oµ thσ DBUNIT« Yo⌡ arσ welcomσ t∩ usσ i⌠ (a⌠ you≥ owε peril)¼ bu⌠ ì
n∩á documentatioε wil∞ bσ provided«á Eventually¼á ß morσ friendl∙ ì
datßá structurσ edito≥ wil∞ bσ provided«á (An∙ clas≤á grou≡á tha⌠ ì
feel≤á reall∙á ambitiou≤ migh⌠ conside≥ writinτ ß datßá structurσ ì
edito≥á fo≥á thσá seconΣá anΣ thirΣá homeworδá project≤á iεá thi≤ ì
course.⌐á WitΦ aε understandinτ oµ thσ relationshi≡á betweeεá thσ ì
datßá structurσ anΣ thσ primitivσ operation≤ oµ thσá DBUNIT¼á yo⌡ ì
shoulΣá bσá ablσ t∩ reaΣ ß listinτ oµ thσ DBUILDE╥á prograφá witΦ ì
relativel∙ littlσ problem¼á anΣ theε shoulΣ bσ ablσ t∩ usσ i⌠ fo≥ ì
step-by-ste≡ viewinτ oµ thσ datß containeΣ iε thσ file« A≤ ma∙ bσ ì
seeεá froφ pagσ ▓ oµ thσ listing¼á thσ DBUNI╘ routine≤ arσ brokeε ì
int∩ severa∞ functiona∞ groupings«á Thσ traversa∞ primitive≤á arσ ì
useΣá fo≥á movinτ arounΣ iε thσ datß structurσ withiε ß pagσá (a≤ ì
containeΣá iεá ß workarea)«á Thσ transfe≥á primitive≤á movσá datß ì
betweeεá workareas¼á anΣ betweeε ß workareß anΣ ß usinτá program« ì
Thσá workareßá primitive≤á arσá useΣ t∩á establisΦá workarea≤á oµ ì
appropriatσá sizes«á Thσ filσ primitive≤ maintaiε table≤ fo≥á thσ ì
onσá o≥ morσ dataabasσ file≤ needeΣ b∙ ß use≥ program«á Yo⌡á wil∞ ì
probabl∙á restric⌠á you≥ attentioε t∩ jus⌠ onσ databasσá filσá iε ì
thi≤ course«á Noticσ als∩ thσ debugginτ primitive≤ a⌠ thσ to≡á oµ ì
pagσá │á oµ thσ listing«á Wheε yo⌡ loaΣ ß pagσ int∩á ßá workareß ì
usinτá DBGETPAGE¼á thσ workarea'≤ locatioε pointe≥ i≤ initializeΣ ì
a⌠á thσ heaΣ oµ thσ firs⌠ grou≡ (grou≡ #0)«á T∩ ge⌠ t∩á thσá nex⌠ ì
grou≡á iεá thσ lis⌠ usσ DBNEXT«á T∩ ge⌠ t∩ thσ firs⌠ recorΣ iεá ß ì
group¼á usσ DBDESCEND«á Iε othe≥ words¼á yo⌡ descenΣ onσ leve∞ iε ì
thσá treσá structureΣ lis⌠ t∩ movσ froφ thσ GROUP╘ leve∞á t∩á thσ ì
RECORD╘ leve∞ (seσ linσ 2░ oε pagσ ▒ oµ thσ listing)«á T∩ ge⌠á t∩ ì
recorΣ ╬ withiε tha⌠ group¼á yo⌡ caε usσ DBSEEK¼ o≥ cal∞ DBNEX╘ ╬ ì
times« T∩ ge⌠ t∩ thσ enΣ oµ thσ lis⌠ iε orde≥ t∩ linδ ye⌠ anothe≥ ì
recorΣá there¼á usσ DBTAIL«á T∩ acces≤ individua∞ field≤ withiε ß ì
record¼á usσ DBDESCEN─ again«á T∩ returε froφ thσ FIELD╘ leve∞ t∩ ì
thσ heaΣ oµ thσ enclosinτ record¼á usσ DBASCEND« DBHEA─ take≤ yo⌡ ì
t∩á thσá locatioε oµ thσ firs⌠ iteφ iε thσ lis⌠á a⌠á thσá curren⌠ ì
level«á DBHOM┼á return≤á yo⌡ t∩ thσ heaΣ oµ thσá outermos⌠á grou≡ ì
leve∞ iε thσ page« DBFINDRE├ i≤ useΣ t∩ scaε througΦ record≤ iε ß ì
singlσá group¼á searchinτá fo≥ ß matcΦ witΦ ß strinτ iεá thσá KE┘ ì
parameter.
Oncσ yo⌡ havσ locateΣ ß desireΣ record¼ yo⌡ ma∙ wisΦ t∩ movσ ì
informatioεá froφá thσá field≤á oµ tha⌠ recorΣá t∩á you≥á callinτ ì
program¼á o≥á yo⌡ ma∙ wisΦ t∩ replacσ informatioε iεá thσá recorΣ ì
witΦá ne≈á information«á Thi≤ i≤ donσ b∙ passinτ thσá informatioε ì
througΦá thσá DBUNIT'≤ "mailboxó variablσ (declareΣá startinτá iε ì
linσ 4╕ oε pagσ ▒ oµ thσ listing)«á Thσ DBMAI╠ recorΣ passe≤á onσ ì
iteφ oµ an∙ typσ oµ informatioε supporteΣ b∙ thσ systeφ usinτ thσ ì
transfe≥á primitive≤ DBGE╘ anΣ DBPU╘ whicΦ arσ simila≥ iε concep⌠ ì
t∩ Pascal'≤ GE╘ anΣ PU╘ useΣ witΦ files«á You≥ prograφ accesse≤ ß ì
valuσ froφ thσ datß structurσ b∙ usinτ DBGET¼á oncσ thσá locatioε ì
pointe≥ ha≤ beeε moveΣ t∩ thσ desireΣ item« DBGE╘ load≤ ß cop∙ oµ ì
thσ iteφ int∩ DBMAIL« Yo⌡ caε theε acces≤ thσ valuσ withiε DBMAI╠ ì
(jus⌠á a≤á yo⌡ caε usσ FID▐ fo≥ ß file)¼á o≥ yo⌡ caεá assigεá thσ ìèvaluσá iε DBMAI╠ t∩ ß variablσ iε you≥ program«á DBPU╘ take≤á thσ ì
valuσá iεá thσ DBMAI╠ variablσ anΣ use≤ i⌠ t∩ replacσá thσá valuσ ì
currentl∙á storeΣá iε thσ datß structurσ a⌠ thσ locatioεá oµá thσ ì
workarea'≤á locatioε pointer«á Thσ DBMAILTYP┼ taτ fielΣ oµ DBMAI╠ ì
mus⌠ bσ useΣ t∩ identif∙ wha⌠ typσ oµ informatioε i≤ beinτ passeΣ ì
viß thσ mailbo° (otherwisσ yo⌡ wil∞ ge⌠ bizarrσ anΣ unpredictablσ ì
results!)«á A⌠ present¼ onl∙ thσ STRING╞ anΣ INTEGER╞ option≤ arσ ì
implemented«á (Iµá yo⌡á arσ eveε morσ ambitious¼á yo⌡á migh⌠á tr∙ ì
addinτá onσ oµ thσ othe≥ type≤ fo≥ thσ seconΣ anΣ thirΣá homeworδ ì
tasks.) Al∞á thσá othe≥ transfe≥ primitive≤ operatσ withiε thσá datß ì
structure¼á anΣ d∩ no⌠ refe≥ t∩ DBMAIL«á Comment≤ iε thσ heading≤ ì
oµ thesσ primitives describe what they do in the DBUNIT listing.
{Walk-thru of a STARTER procedure}
Iµá yo⌡ executσ thσ prograφ DBPRO╟ (showε iε thσ listinτá a≤ ì
DBTEST)¼á anΣá answe≥ thσ promp⌠ b∙ askinτ fo≥ thσ databasσá filσ ì
TESTD┬ (transfe≥ i⌠ witΦ thσ File≥ t∩ you≥ #4║ o≥ #5║ disk)¼ theε ì
thσá operatioεá oµ thσ severa∞ procedure≤ caεá bσá summarizeΣá a≤ ì
follows:
a⌐á F(indreπ wil∞ asδ fo≥ aε approximatσ inde° "key"«á Afte≥á yo⌡ ì
pres≤á <return>¼á ßá portioε oµ thσ inde° wil∞ bσ displayeΣá witΦ ì
selectioε letters«á Picδ ß letter¼á anΣ thσ correspondinτá recorΣ ì
wil∞ be displayed.
b⌐á C(hangereπá allow≤á alterinτ thσ content≤á oµá thσá displayeΣ ì
record«á Selec⌠á thσá fielΣá t∩ alte≥ b∙á pressinτá it≤á selecto≥ ì
letter¼á o≥á b∙ usinτ <return╛ t∩ ge⌠ t∩ thσ nex⌠ field«á Thσ olΣ ì
valuσ oµ thσ fielΣ caε bσ editeΣ o≥ ß ne≈ valuσ substituted«á Seσ ì
pagσá 4│ oµ thσ listinτ fo≥ detail≤ oε thσá SCREADSTR╟á procedurσ ì
useΣá t∩á handlσá thi≤á editing«á Oε thσá Apple¼á usσá thσá ASCI╔ ì
characte≥ "CANó (Control-X⌐ t∩ ge⌠ thσ effec⌠ oµ DE╠ describeΣ iε ì
thσá procedure«á Savσ thσ ne≈ valuσ oµ thσ fielΣ usinτá <return>« ì
<escape╛á return≤á yo⌡á t∩á thσá C(hangereπá contro∞á leve∞áá anΣ ì
redisplay≤á thσ origina∞ valuσ oµ thσ field«á Froφ thσ C(hangereπ ì
contro∞ level¼ <ETX╛ save≤ thσ ne≈ recorΣ value¼ <ESC╛ return≤ t∩ ì
thσ prograφ with no change in the record.
c⌐ N(ewreπ i≤ useΣ t∩ creatσ ß ne≈ record¼á anΣ storσ i⌠ anΣá it≤ ì
index entries in the file.
d⌐á G(etreπá i≤ ß debugginτ procedurσ useΣ t∩ allo≈ yo⌡ t∩á refe≥ ì
explicitl∙ t∩ ß page¼á group¼á anΣ recorΣ numbe≥á location«á Datß ì
record≤á iεá TESTD┬ arσ oε page≤ ▓ anΣ up«á Pagσ ▒á contain≤á thσ ì
currentl∙ implementeΣ singlσ leve∞ index«á Pagσ ░ contain≤ mainl∙ ì
the descriptor groups.
e) Q(uit as it implies gets you out of the program.
f⌐á T(racσá allow≤á manipulatinτá thσ control≤á useΣá t∩á trigge≥ ì
detaileΣá "dumpsóá oµ thσ datß structurσ b∙ thσ DBUNI╘á procedurσ ì
TRACEWA«á Thσ T(racσ displa∙ wil∞ promp⌠ fo≥ tracσ "sites"¼ whicΦ ì
arσá number≤á associateΣá witΦ specifiπá traversa∞á anΣá transfe≥ ì
primitives«á Fo≥ example¼á iµ yo⌡ se⌠ tracinτ fo≥ sitσ #9¼ ß dum≡ ì
wil∞á bσá triggereΣ thσ nex⌠ timσ thσ DBSEE╦ routinσá i≤á entereΣ ì
(Seσá linσ 90╢ oε pagσ 2░ oµ thσ listing.⌐ ┴ tablσ oµá al∞á tracσ ì
site≤á wil∞ bσ provideΣ t∩ thσ clas≤ iε ß supplementar∙á handout« ì
No≈á refe≥ t∩ thσ STARTE╥ procedurσ SAVEINDEXITE═ whicΦ start≤ oε ì
linσ 42░ oµ pagσ 5░ iε thσ listing«á Thσ arra∙ SELEC╘ i≤á assumeΣ ì
t∩á havσá beeε previousl∙ loadeΣ witΦ itemnumber≤ anΣá descripto≥ ìènumber≤ b∙ thσ SHOWRE├ procedure«á ZEROWORKAREA(WA2⌐ i≤ ßá DBUNI╘ ì
procedurσá useΣ herσ t∩ initializσ workareß #▓ (seσ CONS╘ iε linσ ì
15┤ pagσ 46)« Thσ followinτ lis⌠ oµ call≤ t∩ DBEMPTYITEM¼ DBHOME¼ ì
DBDESCEN─á al∞ se⌠ ß dumm∙ intege≥ variable«á Mos⌠ oµ thσá DBUNI╘ ì
routine≤ arσ function≤ whicΦ ma∙ returε ß non-zer∩ erro≥ valuσ iε ì
ß manne≥ simila≥ t∩ aε erro≥ IORESULT«á Iε thσ line≤ showεá here¼ ì
wσ havσ assumeΣ tha⌠ thesσ routine≤ wil∞ ruε correctly¼á anΣ makσ ì
no provision for error handling.
A≤á yo⌡á wil∞á find¼á i⌠ i≤ probabl∙ preferablσ fo≥á yo⌡á t∩ ì
contro∞ al∞ oµ you≥ call≤ t∩ thesσ routine≤ usinτá DBSHOWERR¼á a≤ ì
illustrateΣá oε linσ 46┤ oµ pagσ 51«á Iε tha⌠ case¼á wσ cop∙á thσ ì
iteφá currentl∙ pointeΣ a⌠ iε WA▓ (workareß #2⌐ int∩ thσá curren⌠ ì
positioεá pointeΣ a⌠ iε WA0«á Iµ DBCOP┘ fail≤ (return≤ ß noε zer∩ ì
value⌐áá theεáá thσá messagσá giveεá b∙á thσáá strinτáá paramete≥ ì
'SAVEINDEXITE═ - cop∙ WA▓ t∩ WA0º wil∞ bσ displayed¼ anΣ yo⌡ wil∞ ì
bσá askeΣá ho≈á t∩á proceed«á Wσ eliminatσá thσá spacσá anΣá timσ ì
consuminτá usσá oµ DBSHOWER╥ onl∙ afte≥ enougΦ testinτá ha≤á beeε ì
donσá t∩ sho≈ tha⌠ error≤ arσ ver∙ unlikely«á Yo⌡á wil∞á probabl∙ ì
finΣá tha⌠ ou≥ confidencσ iε usinτ DUMMY:=..«á ha≤ beeε misplaceΣ ì
iε somσ oµ its uses in the STARTER unit.
Iεá linσ 46░ oε pagσ 51¼á wσ se⌠ thσ loca∞ variablσ RSL╘á t∩ ì
thσ valuσ returneΣ b∙ DBDESCEND«á Thi≤ allow≤ thσ prograφ t∩ takσ ì
evasivσá actioε iµ thσ DBDESCEN─ routinσ fail≤ fo≥ ßá predictablσ ì
reason«á Iεá thi≤ casσ DBDESCEN─ migh⌠ fai∞ iµ WA░ i≤á completel∙ ì
empty.
{Homework Problem Topics}
Duσ t∩ shortagσ oµ time¼ thi≤ sectioε wil∞ generall∙ providσ ì
onl∙á ß brieµ recountinτ oµ thσ area≤ iε whicΦ team≤ oµá student≤ ì
ma∙ proposσ homeworδ topics« Aε additiona∞ handou⌠ providinτ morσ ì
detail≤á wil∞ bσ availablσ iε ß fe≈ days«á ┴ poin⌠ oµ cautioεá i≤ ì
tha⌠á therσá arσ probabl∙ severa∞ bug≤ iε thσá prograφá material≤ ì
provideΣá t∩ yo⌡ - ß toucΦ oµ wha⌠ yo⌡ wil∞ als∩ finΣ iεá workinτ ì
iε thσ rea∞ world after leaving UCSD.
Fo≥ thσ firs⌠ homeworδ project¼á al∞ bu⌠ thσ morσá ambitiou≤ ì
groups may wish to attack problem 6.1b, c, or d.
{ISAM Index}
Thσá inde° facilit∙ iε thσ starte≥ prograφ i≤ incompletσá iε ì
many ways. Any of the following would be suitable project tasks:
a⌐ Thσ starte≥ prograφ provide≤ onl∙ ß coarsσ index« ExtenΣ i⌠ b∙ ì
addinτá finσá inde° handling«á Sincσ thσ inde° filσ handlinτá ma∙ ì
makσ thi≤ time-consuming¼á pu⌠ "Updatinτ ..«á ó oε thσ screeεá t∩ ì
sho≈ that work is in progress.
b⌐á Thσ STARTE╥ unit'≤ SAVEINDEXITE═ procedurσ make≤ n∩ provisioε ì
t∩ replacσ aε inde° entr∙ witΦ aε editeΣ entry«á Iµ thσ ne≈ entr∙ ì
differ≤ iε an∙ wa∙ froφ thσ old¼á theε thσ ne≈ entr∙ i≤ addeΣá t∩ ì
thσ index¼á bu⌠ thσ olΣ remains« Repai≥ thi≤ probleφ b∙ arranginτ ì
t∩á replacσá thσ olΣ entr∙ witΦ thσ ne≈á wheεá appropriate«á Thi≤ ì
shoulΣ no⌠ prevent adding new index items when NEWREC is called.
c⌐á Thσá STARTE╥á unit'≤ inde° handlinτ make≤á n∩á provisioεá fo≥ ì
storinτá multiplσá reference≤ t∩ ß singlσ inde°á ke∙á value«á Fo≥ ì
example¼á therσá arσ tw∩ reference≤ iε thσ TESTD┬ filσ fo≥á Texa≤ ìèInstruments¼á bu⌠á onl∙á onσ caε bσ reacheΣ viß tha⌠ ke∙á iεá thσ ì
index« This should be fixed.
d⌐ Relativσ t∩ thσ F(inΣ command'≤ displa∙ oµ Ke∙ values¼ providσ ì
ßá capabilit∙á t∩ usσ thσ U╨ anΣ DOW╬ arro≈ key≤ t∩ ge⌠ thσá nex⌠ ì
datßá record¼á o≥á thσ previou≤ one¼á iε thσá inde°á (alphabetic⌐ ì
sequence.
e⌐á BuilΣá ß completσ inde° froφ ß pre-existinτá DFI─á file¼á fo≥ ì
example to provide a new combination of fields that are indexed.
f⌐á Re-builΣá aεá existinτ ISA═ inde° iεá orde≥á t∩á balancσá thσ ì
occupancy of the several pages.
{Transaction File}
Thσ starte≥ prograφ currentl∙ contain≤ onl∙ primitivσ hook≤ ì
to implement the transaction file.
a) Implement the transaction file initializer/maintainer.
b) Collect transaction data from the keyboard and display it.
c⌐ Displa∙ recen⌠ transactioε record≤ associateΣ witΦ thσ curren⌠ ì
datßá record«áá Implemen⌠á ßá "nextóá capabilit∙á t∩á scrol∞á thσ ì
transactioε records so that earlier ones may be seen.
{Batch Search}
Implemen⌠á ßá genera∞á purposσ mean≤ oµ goinτá througΦá thσ ì
entirσá datßá record≤á file¼á allowinτá specifieΣá processinτá oε ì
selecteΣ records.
{Summary Report Generator}
BaseΣ oε ß batcΦ strategy¼á summarizσ numeriπ datß field≤ iε ì
thσ datß records¼ anΣ providσ ß formatteΣ outpu⌠ repor⌠ whicΦ ma∙ ì
bσ either displayed or printed.
{Reformat a Data Records File}
Providσá ß genera∞ capabilit∙ t∩ creatσ ß ne≈ databasσá filσ ì
witΦá ß newl∙ defineΣ layou⌠ oµ field≤ iε thσ records¼á baseΣá oε ì
inpu⌠ from an old pre-existing file with a different layout.
{Sort/Merge Utility}
Writσá ß utilit∙ prograφ t∩ Sor⌠ and/o≥ Mergσ record≤á iεá ß ì
database«á Thi≤á include≤ ß substantia∞ amoun⌠ oµ disδá handling¼ ì
anΣ i≤ ß fairly major project.
{Garbage Collection}
Afte≥ substantia∞ amount≤ oµ use¼ thσ Datß Record≤ filσ ma∙ ì
becomσ "checkerboardedó witΦ unuseΣ recorΣ locations« RebuilΣ thσ ì
filσá t∩ eliminatσ unuseΣ recorΣ link≤ embeddeΣ withiε thσá file« ì
Thi≤ ma∙ requirσ ---------"Thi≤ i≤ wherσ i⌠ endeΣ oε m∙ disδ s∩ ╔ ì
supposσá ßá smal∞ par⌠ i≤ missing¼á howeve≥ i⌠ won'⌠ effec⌠á you≥ ì
efforts. GOOD LUCK"
PASCAL/Z USERS GROUP
Charlie Fosterè