AMSTRAD cpc 6128 User Instruction page 101

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

.... where r % is an integer variable in which either the record number (where the
string was found) or a code indicating that it was not found, is returned. a $ is the
string to search for. The optional parameter n, specifies which record to begin
searching from. If n is unspecified, then the search will start at the current record.
The second optional parameter m specifies at which record to end the search even if a
match is not yet found.lfm is omitted, the search continues through the whole 64K,
which may overrun the end of the data you have written.
Now try this out. If you have already run the BANK MANAGER program to look at
the screen swapping commands, and have not reset the computer, then the extra
commands will currently be resident in memory. If not, you will need to insert Side 1
of your system discs package, and type:
RUN "BANKMAN"
Now type:
IBANKOPEN,20
This sets the record length to 20 characters and sets the current record to be O.
Now type:
a$="FIRST ENTRY"+SPACE$(9)
.... which sets up a
$
to be exactly 20 characters long.
Now type:
r%=0
.... to initialise r
%.
Now type:
IBANKWRITE,@r%,a$
This will write a
$
into the first record (record 0). Now type:
d$=SPACE$(20)
IBANKREAD,@r%,d$,0
PRINT d$
The first command sets up d $ to contain 20 spaces. This is enough room to contain the
contents of the record when it is read. The second command reads record number 0
and places the result in d $. As the current record would now be stepped to record 1
(by the previous
I
BAN
KW
R I T E operation) it is necessary to specify record 0, as the
record to read. Remember - if no record number is specified, then the current record is
read. Finally the result ofthe reading operation is printed out. Therefore d $ ought to
contain'F I RST ENTRY'and9spaces.
Chapter 1 Page 88
Foundation Course

Advertisement

Table of Contents
loading

Table of Contents