home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 224
/
224.d81
/
t.manual4
< prev
next >
Wrap
Text File
|
2022-08-26
|
5KB
|
162 lines
u
D A T A T O O L
SAVE FILES
Similar to loading, you have the
option to save a worksheet including
all settings as a Datatool program
file, or to export data to any
destination by using your own BASIC
code.
To Save a worksheet, just type in the
filename (you can use quotation marks
to fix the length of the filename) and
press RETURN in the cell of your
choice: save, verify, or both. To
overwrite an existing file, enter @:
before the actual filename. The system
will then scratch the file on disk
before saving (it will not use the
buggy floppy command to overwrite).
Worksheet files are stored as a "prg"
file, and you can actually run them:
If you start a session on the C64, you
can load a worksheet file and run it,
as well as you can load "datatool",8,1
first, and the file afterwards.
The Export option is the counterpart
to the Import option described above.
The opening code is executed once, the
export row code is executed for every
filled data row or result row in the
worksheet (label, pause or BASIC rows
are ignored), and finally the BASIC
sequence for closing the file is
called.
You may use this option for
transferring data to another program
-- e.g. a word processor -- or for
exchanging data between worksheets.
But keep a few rules in mind:
* When opening a file, do not use a
secondary address lower then 2 or
any higher then 14, because they
are reserved for floppy commands.
E.g. open 2,8,2,"filename,s,w"
would be okay to write to a
sequential file. (The examples
later on build up on this opening
example.)
* Although the floppy directory
distinguishes between prg and seq
files, you can't use the same
filename for different filetypes.
* Do not forget to delete a file that
you want to rewrite, using the disk
command
open1,8,15,"s:filename":close1
before opening the actual file for
writing. The BASIC statements
print#, get#, and input#, are quite
comfortable for exchanging data,
but a little bit tricky also. Here
is an overview:
Send
Strings
print#2,x$ sends the content of x$
and a "carriage return" (CR =
CHR$(13)) afterwards, which tells
the end of the variable. (You can
supress the CR by adding a
semicolon (print#2,x$;).)
If the variable is supposed to be
received with input#, it should
not contain a comma, and it should
not be empty (check empty string
before: if x$="" then x$=" " )
Numbers
print#2,x sends a number - not in
any special numeric format, but it
converts it into a string of
digits, ended with a CR. For
sending single Bytes (0-255) you
can convert the Byte in a single
character and send the ASCII-code:
print#2,chr$(x);.
The print# statement can be used
with several variables strung
together, separated by semicolons
or commas. The effect is that all
variables will be sent without
recognizable separation, loosing
their allocation. This only might
be useful in the case that
variables consists of one single
byte by design. Otherwise a single
print# statement should be used
for each variable.
Receive
String
get#2,x$ will fetch one single
byte or character. The only
exception is that if the byte is
zero, x$ won't contain a zero
code, but will have zero length.
If you want to do the
ASC-function, you must calculate
it as x=asc(x$+chr$(0)) in order
to avoid a BASIC error.
Number
get#2,x expects a single digit
coded in ASCII. Any aberration
will be prompted with an error
message. Therefore this variation
is seldom. In order to get a
single byte, use get#2,x$ and the
ASC-function instead.
input#2,x$ will collect characters
until a comma (ASCII 44) or a CR
(ASCII 13) tells the end of the
variable. The received string is
not allowed to have zero length,
and the maximum length is limited
to 80 characters.
input#2,x acts like with string
variables, but converts the
collected string into a numeric
variable. If the received
characters don't fit, it causes an
error message.
The get# and input# statements can be
used with several variables strung
together, separated by commas. This is
not a counterpart to the similar
looking print# statement. The
variables strung together will be
received in the same way as it would
be with several single statements
concerning one variable each.
FK
MORE TO COME!