EasyManuals Logo

Sinclair QL User Manual

Sinclair QL
422 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #350 background imageLoading...
Page #350 background image
Programming
From the edit level, press
F3
and N
to
start
entering getrec.
proc
getrec
rem
*****
locate
a
particular
record
*****
c Ls
let
ok$
="n
ll
input
"who?
";
n$
if
n$
<>""
find
n$
whi
le
ok$
<>'Iyll and
found()
print
title$
;
It
";
fname$(1);
II
";
surname$
print
street$
print
"0K
(yin)?
";
Let ok$
=Lower(getkey())
cts
if
ok$
<>"
y
tl
continue
endif
endwhi
le
if
not
found()
print
n$ ; "
not
found"
endif
end
if
endproc
The search uses the find command,
so
that the text
IS
tound
In
any string field.
You
can therefore Identify a record
by
name or
by
address. Of course, the
first
record which
matches may not be the one you
want,
so
we
have
to
be able
to
continue the search.
This
is
the purpose of the while endwhile loop. This prints out the name and
first
line
of the address,
to
identify the record, and asks you
If
that
IS
the right record.
If
you
do
not respond by pressing the Y
key,
it
continues the search. The loop ends either when
you answer by pressing the Y
key
or when the text
is
not found
in
any
of
the remaining
records. Note that the function foundO returns a true (non-zero) value
if
the search
IS
successful.
Since ok$ could
initially be
''y''
(from a previous successful search)
we
must give
II
some
other value
at
the beginning of the procedure, before entering the loop. This makes sure
that the loop
will
be used
at
least once.
We
can now write the pay procedure:
proc
pay
rem
*****
record
subscription
payment
*****
c Ls
let
n$
="x"
whi
le
n$
<>"11
getrec
if
ok$
=" y"
let
issues
=issues
+6
update
endif
endwhile
endproc
The loop
in
this procedure continues until
n$
IS
an empty string. This allows
you
to
record
several payments without having
to
select the pay option for each
one.
When you have
finished, just press
ENTER
in
response
to
the 'v,ho?" prompt,
If
the value of ok$
is
y
after the call
to
getrec then
the
payment
IS
recorded by marking
it
as
valid for a further
six
Issues,
Again
we
have
to
set the initial value of
n$
to
some appropriate value (anything except
the
empty string)
to
make sure that the procedure
IS
not affected by a previous operation.
The procedure
to
allow you
to
change the contents of a record
is
now very
easy.
Again Changes
you must be able
to
select a particular record
to
change,
so
the general structure can
be identical
to
pay.
12/84
23

Other manuals for Sinclair QL

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair QL and is the answer not in the manual?

Sinclair QL Specifications

General IconGeneral
ProcessorMotorola 68008
Clock Speed7.5 MHz
RAM128 KB (expandable to 640 KB)
ROM48 KB
Operating SystemSinclair QDOS
Release Year1984
StorageMicrodrive tape loop
Graphics256x256 pixels, 8 colors
PortsRS-232, ROM cartridge
SoundBeeper (internal speaker)

Related product manuals