
The
OPEN
statement
has
the following
general
form:
OPEN
"jlle.number:"devlcejlle·name"
l,/lle.
orguoizallonll,/lie·typel
I.open.modell,record.type)
Tbejile·number
and
devtcejlle·name
must
be
Included
In
the
OPEN
statemenl.
The
other
Informallon
may
be
In
any
order.
or
may
be
omitted.
If
an
Item
:s
omitted.
the
compuler
assumes
certain
defaults.
which
are
descrlbed below.
.flle.number
-
Thejile.number
II
through
255)
Is a9Slgned to a
particular
me
by
the
OPEN
statemenl.
lFlle
number
0
Is
the
keyboard
and
screen
of
the
computer.
II
cannot
be
used
for
other
flies
and
Is
always
open.)
You
may
a9Slgn file
numbers
as
you
wish. with
each
me
haVing adifferent
number.
Thejlle-number
ls
entered
as
a
number
sign (") followed
by
a
numeric
expression
that.
when
rounded
10
the
nearest
Integer.
Is
a
number
from
Ito
255.
and
Is
not
the
number
of
afile
that
Is
already
open.
•
devicejlle-name
-
The
device. refers
to
the
diskette
on
which
a
particular
file
Is
stored.
If afile
Is
on
a
diskette
In Disk Drlve One.
the
device
Is
DSKI.
For
Drlve
Two.
the
device
Is DSK2.
For
Drive
Three.
the
device Is DSK3.
Thejile·name
may
be
any
valid file
name.
Instead
of
the
disk
drlve
number
you
may
use DSK. followed
by
the
diskette
name.
a
perlod.
and
then
me
jile·name.
OPEflllll :"DSK.DISKmE.ALE1"
The
computer
wlll
search
all
drives
for
the
diskette
with
the
name
you
give.
•
flle-organizatlon
-
Flies
can
be
organized
either
sequentially
or
randomly.
Records
In a
sequential
file
are
read
or
written
one
after
the
other.
Records
on
random
files
can
be
read
or
written
In
any
order.
They
may
also
be
processed
sequenllally.
To
Indicate
which
structure
the
file
has.
enler
either
SEQUENTIAL
for
sequential
files
or
RELATIVE for
random
meso You
may
optionally specify
the
lnllla!
number
of
records
on
afile
by
following
the
word
SEQUE:'oITlAL or RELATiVE
with
a
numenc
expression.
If
you
do
not
specify
thejile-organizallon.
the
default
Is SEQUENTIAL.
For
processing
files
In
order. SEQUENTIAL flies
are
usually
processed
more
quickly
than
RELATIVE
meso
But
In
some
uses.
random
flies
are
more
efficient.
30
_jlle.type
-Flies
can
be
stored
on
diskettes
either
in
easlly
readable
ASCII
characters
or
In
machine'
readable
binary
form. If
the
Information
Is
going
to
he
printed
or
displayed
for people
to
use.
ASCII
format
Is
usually
a
better
choice. However.
binary
records
take
up
less
space
and
are
processed
more
quickly
by
the
computer.
To
specify
that
you
wish
the
file to
be
In ".SCII formal.
enter
DISPLAY.
(The
length
ofa
DlSPLAY·type record
Is
UmlLed
to
about
150
bytes.)
To
specify
binary
formal.
enter
INTERNAL. If
you
do
not
specify
ajiie·type.
the
default
Is DISPLAY.
_open-mode -
This
entry
Instructs
the
computer
lhal
lhe
file
may
be
bolh
read
and
...-rlLten
upon
(UPDATEI.
thai
Il
may
only
be
read
(INPUT).
that
It
may
only
be
wrllLen to (OUTPUT).
or
thalli
may
only
be
added
to lAI'PEND).
If afile
Is
marked
as
protected.
It
cannot
be
wrlllen
to
and
may
only
be
opened
for
input.
Also. APPEND
mode
can
only
be
specl!led for
VARIABLE
length
records. If
you
do
not
specify
an
open.mode.
the
computer
assumes
the
default
UPDATE.
Note:
If
an
unprotected
file
already
exists
on a
diskette.
specifying
an
open-mode
of OUTPUT to
the
same
file
name
writes
over
tt.e
existing
file with
lhe
new
file. You
can
prevent
this
by
reading
all
the
exlsllng
records
so
that
you move
to
the
end
of
the file
or
by
using
the
RESTORE
statement
wlUn
lhe
proper
record.
•
record.type
-
Ale
records
may
be
all
the
same
length
(FIXEDI
or
may
vary In
lenglh
IV
ARIABLE).
If
they
are all
the
same
length.
any
thai
arc
shorter
are
padded
10
make
up
lhe
difference.
Any
lhat
arc
longer
may
be
truncated
to
the
proper
length. Flies
that
have
FIXED·
length
records
are
processed
faster
than
files
wllh
VARIABLE·length
records.
If
you
like.
you
may
specify ama><lmum
length
of
a
record
'oy
follOWing VARIABLE
or
FIXED
with
a
numeric
expression.
The'
maximum
lengUn for a VARlABLE file Is 254 bytes.
and
the
maximum
for aFIXED file
Is
255
bytes.
If
you
do
not
specify a
record
length.
the
default
Is
80.
RELATIVE flies
must
have
FIXED
lenglh
records.
If
you
do
not
specify arecord·
type
for aRELATIVE file.
lhe
default
Is FIXED.
SEQUENTIAL rues
may
be
either
FIXED or VARIABLE.
If
you
do
not
specify arecord·
type
for aSEQUENTIAL file.
lhe
default
Is
VARlABLE. A
AXED·length
file
may
be
reopened
for
either
SEQUENTiAL
or
RELATIVE
access
Independent
of
prevlou.jile-
organtzallon
assignments.
31