qb45advr.hlp (Topic list)
LSET Statement Details
  QuickSCREEN      Details      Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
LSET Statement Details
 
Syntax
LSET {stringvariable=stringexpression | stringexpression1=stringexpression2}
 
The stringvariable is usually a random-access file field defined in a FIELD
statement, although it can be any string variable. The stringexpression
is the value assigned to the variable.
 
If stringexpression requires fewer bytes than were defined for
stringvariable in the FIELD statement, the LSET function left-justifies
the string in the field (RSET will right-justify the string). Spaces are
used to pad the extra positions. If the string is too long for the field,
both LSET and RSET truncate characters from the right. Numeric values must
be converted to strings before they are justified with the LSET or RSET
statements.
 
You may also use LSET or RSET with a string variable not defined in a FIELD
statement to left-justify or right-justify a string in a given field. For
example, the program lines
 
  A$=SPACE$(20)
  RSET A$=N$
 
will right-justify the string N$ in a 20-character field. This can be
useful for formatting printed output.
 
You can use LSET to assign one record variable to another. The following
example copies the contents of RecTwo to RecOne:
 
  TYPE TwoString
     StrFld AS STRING * 2
  END TYPE
 
  TYPE ThreeString
     StrFld AS STRING * 3
  END TYPE
  DIM RecOne AS TwoString, RecTwo AS ThreeString
  .
  .
  .
  LSET RecOne = RecTwo
 
Notice that LSET is used to assign record variables of differing types.
Record variables of the same type can be assigned using LET. Also, because
RecOne is only two bytes long, only two bytes are copied from RecTwo.
LSET copies only the number of bytes in the shorter of the two record
variables.