Download Print this page

Radio Shack TRS-80 Model II Reference Manual page 49

Disk operating system
Hide thumbs Also See for TRS-80 Model II:

Advertisement

Model II
TRSDOS
CREATE
Create a Preallocated File
CREATE file {NGRANS=n1, NRECS""n2, LRL""n3, TYPE""/etter}
file is a file specification.
NGRANS""n1 indicates how many granules to allocate. If
NGRANS
is
omitted, the number of granules allocated is determined by
NRECS
and
LRL.
NRECS""n2 indicates how many records to allow for. If
NRECS
is omitted,
NGRANS
determines the size of the file. When
NRECS
is given,
LRL
must
also be given.
LRL""n3 indicates the record length (Fixed-length records only). n3 must be
in the range [1,256]. If
LRL
is omitted,
LRL=256
is used. When
LRL
is
given,
NRECS
must also be given.
TYPE ""letter specifies the record type: letter equals F (Fixed-length records)
or V (Variable-length records). If
TYPE
is omitted,
TYPE=F
is used.
NOTE:
{NGRANS}
and
{NRECS,LRL}
are mutually exclusive.
This command lets you create a file and pre-allocate (set aside) space for its
future contents. This is different from the default (normal)
TRSDOS
procedure, in which space is allocated to a file dynamically, i.e., as necessary
when data is written into the file.
With preallocated files, unused space at the end of file is not deallocated
(recovered) when the file is Closed. With dynamically allocated files, on the
other hand, unused space at the end of the file IS recovered when the file is
Closed.
Note: With pre-allocated files,
TRSDOS
will allocate extra space when you
exceed the pre-allocated amount during a write operation.
You may want to use
CREATE
to prepare a file which will contain a known
amount of data. This will usually speed up file write operations, since
TRSDOS
won't have to do periodic allocations during the write operations. File reading
will also be faster, since pre-allocated files are less dispersed on the diskette-
requiring less motion of the read/write mechanism to locate the records.
Examples
CREATE DATAFILE/8AS
NRECS=300, LRL=256
Creates a file named
DATAFILE/BAS,
and allocates space for 300 256-byte
records.
CREATE TEXT/1
NGRANS=100, TYPE=V
Creates a file named
TEXT/1,
and allocates 100 granules. The file will contain
variable-length records.
82

Advertisement

loading