Commodore PET User Manual page 274

Table of Contents

Advertisement

le
PR
1
NT"::1fJ. REAII NAME I1ATA FILE •• ": PR
1tH
213 PR 1
NT".. MOUNT TAPE; PRESS <RETURN:> l.JHEN REAII'T''': PR 1
~n
313 GET A$: IF A$="" THEN 313
413 PRINT" •• OPENING I1ATA FILE •• ": OPEN 1 d , 13 .. "NAME":
PF~INT
513
FOR
J=1
TO
4
613 INPUT#1,F$,M$,L$
713 PRINT F$.;" ".;
~1$;"
".; L$
813 NEXT
~T
$le PRINT" •• CLOSING I1ATA FILE •• ":CLOSE1
11313 ENII
•• READ NAME I1ATA FILE ••
•• MOUNT TAPE; PRESS <RETURN> WHEN READY ••
•• OPENING I1ATA FILE ••
PRESS PLAY ON TAPE
#1
OK
ARNOLD J. SIMPSON
BETTY S.
CLARK
HEADLY GEORGE JOYCE
CAROL ANNE SMITH
•• CLOSING DATA FILE ••
Sample Program
This sample program demonstrates how ta read complex records of data
from a data tape. This program, called MAIL. INPUT:#:, reads the mailing list data,
which was written ta data file MAIL byaprogramtitledMAIL.PRINT:#:
(MAIL. PRINT:#: listing, page 250). Each MAIL file record contains five fields;
these fields are reserved for the record number, customer name, street. city, and
state and ZIP code. Below is an example of a MAIL file record:
•• RECORD #6 ••
field
1
W1 DGETS SUPPL Y CO.
field 2
555 BOGUS AVE.
field
3
GERTIE
field
4
TENNESSEE
38991
field 5
Foliowing is a program listing of MAIL.lNPUT#. Type in MAIL.lNPUT# and
save it on a cassette tape. Then list the program to foliow the step-by-step discus-
sion.
261

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents