MAIL
INPUT*
10
PR1
tH"
::»++++++++++++++++++++++'!t'++++"
20
PRINT"+
+"
30
PRItH"+
REA!!
~1AIL
FILE
W,···'
INPUT#
+"
40
PRINT"+
+"
513
PR 1NT"
+++++++++++++++++++++++++++'!t'''
,PR1
~H
, PR 1
NT
60
PRINT"++
PRESS
<RETURN>
~.JHEN
TAPE
IS
LClA!!ED
'!t''1o)l''
7'0 GET
A$'
1F
A$=""
THEN
7'0
::::0
PRINT"'!t'+ C1PEt'lING MAIL
FILE
++":
OPEN1,
1.,13.,
"MAIL"
90
PF:ItiT":I!1t'+ REAIIING MAIL
FILE
+ot"
100
IF
ST=64
THEN
9999
11(lINPUT#1
..
I$
12121
1NPUT#1 ,
N~1$
1:.::0
INPUT#l,
AU
14121
INPUT#L
A2$
15121
1NPlIT#1
.'
A3$
160
PRINT"::»+
RECORD
#".:
U;"
++"
17121
PRINT"~AME'''.:
TAB(:3).:
~lt'1$
1::::121
P":INT"ADDR:".:
TA:E:(9).;
Al$
190
PRINTTAB(9);A2$
200
PRINTTAB(9);A3$
210
PRINT"~":
;~2121
1
t~PUT"
ENTE":
..
'y.,
TO
F':EAII
NE;"';T
RECOF':D".;
A$ , 1F
A$="
'T'"
GOTO
1
(10
9999
PR 1NT"
~+
Et'lI! OF
~1A
1L
FILE
--PF':OGRAt'l
TER~1
1NATED" , CLOSE
l'END
The procedure for reading from data files is:
1.
Create
and/or
LOAD the program file.
2.
OPEN
the data file.
3.
READ
the data file.
4.
CLOSE
the data file.
The first five lines display a brief program description. The next
two
lines. 60
and 70. instruct the user ta
mount
the data tape.
We
are
now
ready ta begin read-
ing customer addresses. First the data file must
be
opened.
MAIL
is
opened
as
logical file
#1
on the cassette
unit
#1.
This correlates ta
how
it was saved in
MAIL.PRINT#. The secondary address
must
be
0 for
READ.
::::(1
PR
INT"of'of'
OPE~lItK;
MAIL
FILE
of''!t''': OPEN1
..
1.,1:::1.·
"t'1AIL"
Next. read the data. Line 100 uses the status ward
(ST)
ta check for the
End
of File mark. If
ST
=64
(indicating
an
End
of File mark
is
found). then the file
is
closed at line 9999. The
ST
should be checked before data
is
read
sa
that vou do
not
attempt
ta
do any unnecessary reading when there
is
no more data.
Lines 110
ta
150 read the data using INPUT#. Each field was printed ta the
tape
with
an
individual PRINT#; the fields are separated by carriage returns sa
each field
will
be
read in turn
with
an
individual INPUT#. The variable or string
names may
be
different when reading the data than when
writing
the data. For in-
stance. data may
be
written
ta the tape
as
X$ and read back fram the tape
as
A$.
and the
PET
will
not
know the difference because the data variable name
is
not
saved.
262