Sharp MZ-700 Owner's Manual page 70

Hide thumbs Also See for MZ-700:
Table of Contents

Advertisement

2.3.1 0
Data file input/output commands
Although the SAVE and LOAD commands can be used to write or read program text, other commands
are used to record or read the various types of data which is handled by programs. These commands
are described below.
Format
Function
Opens a data file on cassette tape
WO PEN
WOPEN
<
file name
>
prior to writing data to it. This
(abbreviated W.)
command
also
assigns a name to
the data
file.
PRINT/T
PRINT/T d1
<,
d2, d3
, .
.
.
dn
>
Writes data to cassette tape in the
(abbreviated ? /T)
dn ..
..
Numeric data or string data
same format as it would be displayed
by the PRINT statement.
Searches for the data ftle on cassette
ROPEN
ROPEN
<
file name
>
tape with the specified name and
(abbreviated RO.)
opens that ftle to prepare for reading
data from it.
Used to input data from a cassette
INPUT/T
INPUT /T v 1
<
,
v
2
, v 3
,
.
.
.
vn
>
ftle and pass it to the program (in a
manner similar to that in which the
(abbreviated I./T)
vn .
.
..
Numeric data or string data
INPUT statement is used to input
data from the keyboard).
CLOSE
Statement which closes cassette data
(abbreviated CLO.)
CLOSE
ftles after writing or reading has
been
completed.
Unlike the LOAD and SAVE
commands,
no messages are displayed by execution of the WOPEN and
ROPEN
statements.
If display of a message is
desired,
use the PRINT statement to define one in the program.
Note: When an ordinary cassette recorder is used, it may not be possible to record data files even
if
no
problems are encountered in storing or reading programs with the SAVE and LOAD commands.
(Example
1)
The following program writes the numbers from 1 to 99 on cassette
tape.
1
0 WO
PEN
"
DATA
"
2
0
F OR X=1
T
O 99
3
0
PRIN
T/
T
X
4
0
NE XT
X
5
0 C
LO
SE
6
0
END
(Example 2)
The following program reads data from the data file prepared in Example 1
above.
Before execut-
ing this program, be sure to rewind the cassette tape.
10 RO
PE
N
"
DAT
A
"
2
0
F OR
X=1
T
O 99
3
0
INPUT
/
T A
4
0
PRIN
T A
5
0
NE XT
X
60 C LOS
E
7
0
END
68
-------------------------------------------------------------------

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents