Chapter
10
I
BASIC
Keywords
LSET
Statement
LSET
field
name
=
data
Moves
data
to the direct access buffer and places
it
in
field
name,
in preparation for a PUT statement.
Field
name
is
a
string variable defined in a FIELD statement.
You must have used FIELD to set up buffer fields before using
LSET.
You must convert numeric values to string values before they are
LSET. See MKI$, MKD$, MKS$.
You use LSET to left-justify the variable in the field.
If
the field
is larger than the variable it
is
receiving, the field is filled with
blanks on the right.
If
the variable
is
larger than the field, char-
acters are truncated on the right. The complement command to
LSET is RSET.
See also Chapter
7,
“Files,” and OPEN, CLOSE, FIELD, GET,
PUT, and RSET.
Example
Suppose NM$ and
AD$
have been defined as field names for a
direct access file buffer. NM$ has a length
of
18
characters; AD$
has
a
length of 25 characters. The statements:
LSET
NM$
=
“JIM CRICKET, JR.”
LSET
AD$
=
“2000
EAST
PECAN
ST.”
set the data in the buffer as follows:
JIMMCRICKET,JR.BBM
2000MEASTMPECANMST.MMB~BM
Notice that filler blanks are placed to the right of the data
strings in both cases. If we use
RSET
statements instead of
LSET, the filler spaces are placed to the left. This is the only
difference between LSET and RSET.
215