•
Some
Techniques
SEQUENTIAL
DATA
FILES
The following program will establish a file of one hundred numbers.
100
REMark
Number
Fi
Le
110
OPEN
NEW
#6,mdv1
numbers
120
FOR
cum = 1
TO
100
130
PRINT
#6,num
140
END
FOR
num
150
CLOSE
#6
After running the program check that the filename 'numbers'
is
in
the
directory
by
typing:
DI R mdv1 numbe
rs
You
can get a view
of
the file without any special formatting by copying from Microdrive
to
screen:
Numeric File
•
COPY
mdv1
numbers
to
ser
You
can also use fhe following program
to
read the
file
and display
its
records on the
screen.
100
REMark Read
File
110
OPEN
IN
#6,mdv1
numbers
120
FOR
cum =1
TO
100
130
INPUT
#6,item
140
PRINT I
item
I
150
END
FOR
num
160
CLOSE
#6
If
you wish you can alter the program
to
get the output
in
a different form.
In
a similar fashion the following programs
will
set up a file of one hundred randomly Character File
selected letters and read them back.
•
100
REMark
Letter
Fi
Le
110
OPEN
NEW
#6,mdv1
ehfi
Le
120
FOR
cum =1
TO
100
130
LET
eh$
= CHR$(RND(65
TO
9OJ)
140
PRINT
#6,eh$
150
END
FOR
num
160
CLOSE
#6
100
REMark
Get
Letters
110
OPEN
IN
#6,mdv1
ehfi
Le
120
FOR
cum =1
TO
100
130
INPUT
#6,item$
140
PRINT I
item$
I
150
END
FOR
num
160
CLOSE
#6
FOR
SERVICE MANUALS
CONTACT:
MAURITRON
TECHNICAL
SERVICES
www.mauritron.co.uk
TEL:
01844·351694
FAX:
01844
.
352554
Suppose that you
Wish
to
set
up a simple file of names and telephone numbers.
RON
GEOFF
ZOE
BEN
MEG
CATH
WENDY
678462
896487
249386
584621
482349
438975
982387
SETIING
UP
A
DATA
FILE
The following program
will
do
it.
100
REMark
Phone
numbers
110
OPEN
NEW
#6,mdv1
phone
120
FOR
record
=1 TO-7
130
INPUT
name$,num$
140
PRINT
#6;name$;num$
150
END
FOR
record
160
CLOSE
#6
12/84
95