bas7advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
LSET Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
LSET moves data from memory to a random-access file buffer (in preparation
for a PUT statement), copies one record variable to another, or
left-justifies the value of a string in a string variable.
 
LSET stringvariable=stringexpression
    ■ The argument stringvariable usually is a random-access file field
      defined in a FIELD statement, although it can be any string variable.
LSET recordvariable1=recordvariable2
    ■ You can use LSET to assign one record variable to another.
 
Usage Notes
    ■ 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 right-justifies 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 statement.
    ■ LSET can be used with a string variable not defined in a FIELD
      statement to left- or right-justify a string in a given field. The
      following example right-justifies the string N$ in a 20-character
      field:
 
        A$=SPACE$(20)
        LSET A$=N$
 
    ■ You can use LSET to assign one record variable to another.
      The following example copies the contents of RecTwo to RecOne.
      Only the number of bytes in the shorter of the two record
      variables are copied.
 
        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 this example demonstrates copying record variables of
      different data types. You also can use LSET to copy record variables
      of the same type.