Herunterladen Inhalt Inhalt Diese Seite drucken

File Naming Conventions; File Processing - Texas Instruments Php 1240 Bedienungsanleitung

Diskehensystem
Inhaltsverzeichnis
Verfügbare Sprachen
  • DE

Verfügbare Sprachen

~
TEXAS INSTRUMENTS
RLE NAMING CONVENTIONS
The name of a file can be up to ten characters long, and may use
any characters except the period and the space characters. Valid
names for fil es are the same as val id names for diskettes.
RLE PROCESSING
There are seven mai n TI BASIC statements that are used to access
files on diskettes. They are OPEN, CLOSE, INPUT, PRINT, EOF, RE-
STORE, and DELETE. In addition, a special subprogram named
CALL ALES allows you to change the number of files allowed to be
opened at the same ti me. The following discussions of each of the-
se statements relate to their use with the disk system.
OPEN - The OPEN statement prepares a TI BASIC program to use
data files stored on diskettes. lt provides a link between a file-num-
ber used in a program and the file on the diskette, and it describes
a file's characteristics so that a program can process or create the
file. lf the file already exists, the description that is gwen in the pro-
gram must match the actual characteristics of the file.
The OPEN statement has the following generai form:
OPEN
*
fi/e-number:"device.file-name"[.file-
organisation] [.file-type] [.open-mode]
[.record-type]
The file-number and device.file-name must be included in the
OPEN statement. The other information maybe in any order, or may
be omitted. lf an item is omitted, the computer assumes certain de-
faults, which are described below.
e
file-number- The file-number (1 through 255) is assigned to a
particular file by the OPEN statement. (File number O is the key-
board and screen ofthe computer.lt cannot be used forotherfi-
les and is always open.) You may assign file numbers as you
wish, with each file having a different number.
The file-number is entered as a number sign (*-) followed by a
numeric expression that, when rounded to the nearest integer,
is a number from 1 to 255, and is not the number of a file that is
already open.
• device.file-name- The device. refers to the diskette on which a
particular file is stored. lf a file is on a diskette in Disk Drive O ne,
the devi ce is DSK1. For Drive Two, the devi ce is DSK2. For Drive
Three, the device is DSK3. The file-name may be any valid file
n a me.
lnstead of the disk drive number you may use DSK. Followed by
the diskette name, a period, and then the file-name.
OPEN
*
1 :"DSK.DISKETTE.FILE1"
The computer will search ali drives for the diskette with the
name you give.
• file-organisation- Fil es can be organised either sequentially or
randomly. Records in a sequential file are read orwritten one af-
ter the other. Records on random fil es can be read or written in
any order. They may also be processed .sequentially.
T o indicate which structure the file has, enter either SEQUEN-
TIAL for sequential files or RELATIVE for random files. You may
optionally specity the initial number of records on a file by follo-
wing the word SEQUENTIAL or RELATIVE with a numeric ex-
pression. lf you do not specity the file-organisation, the default
is SEQUENTIAL.
For Processing fil es in order. SEQUENTIAL fil es are usually pro-
cessed more quickly than RELATIVE files. But in some uses,
random files are more efficient.
11
<!ID
PHP 1240
e
file-type- Files can be stored on diskettes either in easily rea-
dable ASCII characters or in machine-readable binary form. lf
the information is going to be printed or displayed for people to
use, ASCII format is usually a better choice. However, binary re-
cords take up less space and are processed more quickly by
the computer.
T o specify that you wish the file to be in ASCII format, enter DIS-
PLAY. (The length of a DISPLAY-type record is limited to about
150 bytes.) T o specity binary format, enter INTERNAL. lf you do
not specity a file-type, the dafault is DISPLAY.
e
open-mode- This entry instructs the computer that the file may
be both read and written upon (UPDATE), that it may only be
read (INPUT), that it may only be written to (OUTPUT), or that it
may only be ad d ed t o (APPENO).
lf a file is marked as protected, it cannot be written to and may
only be opened for input. Al so, APPENO mode can only be spe-
cified for VARIABLE length records. lf you do not specity an
open-mode, the computer assumes the default UPDATE.
Note: lf an unprotected file already exists on a diskette, speci-
tying an open-mode of OUTPUT to the same file name writes
over the existing file with the new file. You can prevent this by
reading ali the existing records so that you move to the end of
the file or by using the RESTORE statement with the proper re-
cord.
e
record-type- File records may be ali the sa me length (FIXED) or
may vary in length (VARIABLE).If they are ali the same lenth, any
that are shorter are padded to make up the difference. Any that
are longer may be truncated to the proper length. Fil es that ha-
ve RXED-Iength records are processed faster than files with
VARIABLE-Iength records.
lf you like, you may specify a maximum length of a record by fol-
lowing VARIABLE or FIXED with a numeric expression. The ma-
ximum lengt fora VARIABLE file is 254 bytes, and the maximum
for a RXED file is 255 bytes. lf you do not specify a record
length, the default is 80.
RELATIVE files must have FIXED length records. lf you do not
specity a record-type fora RELATIVE file, the default is FIXED.
SEQUENTIAL fil es may be either FIXED or VARIABLE. lf you do
not specity a record-type for a SEQUENTIAL file, the default is
VARIABLE. A FIXED-Iength file may be re-opened for either SE-
QUENTIAL or RELATIVE access independent of previous fi/e-or-
ganisation assignments.
The following are examples of OPEN statements.
OPEN* 1:"DSK1.MYFILE"
Creates or re-opens a file on the
diskette in Drive One with a name
of MYRLE. The file is SEQUENTIAL,
kept in DISPLAYformat, in UPDATE
mode with VARIABLE length re
cords with a maximum length of 80
bytes. (These are the default attri-
butes assigned by the computer.)
OPEN
*
23: "DSK.MYDISK.X", Creates or re-opens a file named X
RELATIVE 100, INTERNAL,
on the diskette named MYDISK in
OUTPUT, RXED 80
whichever drive it is located. The fi-
le is RELATIVE, kept in INTERNAL
format, in OUTPUT mode with FI-
XED length records with a maxi-
mum length of 80 bytes. lnitially,
100 records are made available for
the file.
Inhaltsverzeichnis
loading

Inhaltsverzeichnis