~
TEXAS INSTRUMENTS
OPEN*243:A$,1NTERNAL
lf A$ equals DSK2.ABCD, creates
or re-opens a file on the diskette in
Drive Two with a name of ABCD.
The file is SEQUENTIAL, kept in
INTERNAL forrnat, in UPDATE mo-
de with VARIABLE length records
with a maximum length of 80 bytes.
CLOSE- The CLOSE statement discontinues the associati o n bet-
ween a file and a program. After the CLOSE statement is perfor-
med, the file is not available unless it is opened again with an OPEN
statement. Files may optionally be deleted by adding: DELETE to
the end of the CLOSE statement.
The CLOSE statement has the following generai form:
CLOSE
file-number (:DELETE)
The file-number is the number which you used in the OPEN state-
ment to open the file.
lf you do not close a file, data on it may be lost. lf a program ends
due to a BREAK statement, due to pressing
(CLEAR),
or because of
an error, files may not be closed even if you have a CLOSE state-
ment in the program. However, you can close the files properly by
entering NEW, or BYE if you wish to leave BASIC. Editing the pro-
gram also automatically closes any open files.
Note: lf you leave TI BASIC by pressing (QUIT), data may be lost.
Leave TI BASIC on/y by entering BYE when you are processing fi-
les.
INPUT- The INPUT statement, used with diskettes, allows you to
read data from files. lt can only be used with files opened in INPUT
or UPDA TE mode.
The INPUT statement has the following generai form:
INPUT file-number
[,REC record-number] :variable-list
The fi/e-number and a variab/e-/ist must be included in the INPUT
statement. The record-number may optionally be included when
reading random-access files.
e
file-number- The file-number is the number assigned t o a parti-
cular file by the OPEN statement. 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
the number of a file that is open.
• record-number- A record-number refers to the record on the fi-
le which you want to read. The record-number can only be spe-
cified for RELATIVE fil es. (SEQUENTIAL fil es are read in sequen-
tial order.)
e
variab/e-/ist- The variab/e-/ist is the list of variables into which
you want the data from the file to be read. lt consists of string or
numeric variables separated by commas.
The following are examples of INPUT statements.
INPUT
*
1 :X$
Puts into X$ the next value availa-
ble in the file that was opened
as*
1.
INPUT* 23:X,A,LL$
INPUT
*
11, REC 44:TAX
Puts into X, A, and LL$ the next
three values from the file that was
opened as
*
23.
Puts into TAX the first value of re-
cord number 44 of the file that was
opened as
*
11 .
12
INPUT* 3:A,B,C,
<ffi)
PHP 1240
Puts into A, B, and C the next three
values from the file that was ope-
ned as 3. The comma after C crea-
tes a pending input condition.
When the next INPUT statement
using this file is performed, one of
the following actions occurs:
lf the next INPUT statement has no
REC clause, the computer uses the
data beginning where the previous
INPUT statement stopped.
lf the next INPUT statement inclu-
des a REC clause, the computer
terminates the pending input con-
dition and reads the specified re-
cord.
PRINT- The PRINT statement allows you to write data onto fil es o n
diskettes. lt can only be used with fil es opened in OUTPUT, UPDA-
TE, or APPENO mode.
The PRINT statement has the following generai form:
PRINT
*
file-number [,REC record-number]
[:print-/ist)
The file-number must be included in the PRINT statement. The re-
cord-number may optionally be included when writing to random-
acces (RELATIVE) files. The print-list ist also optional.
e
file-number- The file-number is the number assigned t o a parti-
cular file by the OPEN statement. The file-number is entered as
a number sign (*) followed by a numeric expression that, when
rounded to the nearest integer, is a numberfrom 1 to 255 and is
the number of a file that is open.
e
record-number- A record-number refers to the record on the fi-
le which you want to write. The record-number can only be spe-
cified for random files (RELATIVE).
e
print-list- The print-/ist is the list of values that you want to put
o n the file. lt consists of string or numeric vari ab l es or constants
separated by commas, colons, and semicolons.
The following are examples of PRINT statements.
PRINT
*
1 :X$
Puts the value of X$ into the next
position of the file that was opened
as*
1.
PRINT* 23:X;A;"TIMES 4"
Puts the value of X, A, and "TIMES
4" into the next record in the file
that was opened as
*
23.
PRINT
*
11,REC 44: "TAX"
Puts the string constant "TAX" into
record number 44 of the file that
was opened as
*
11 .
PRINT
*
3:A;B;C,
Puts the values of A, B, and Cinto
the next three positions in the file
that was opened as
*
3. The com-
ma after C creates a pending print
condition. When the next PRINT
statement is performed, o ne of the
following actions occurs:
lf the next PRINT statement has no
REC clause, the computer places
the data immediately following the
previous data.