advr.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, RSET Statements Details
  ◄Summary►  ◄Details►  ◄Example►                ◄Contents►  ◄Index►  ◄Back►
──────────────────────────────────────────────────────────────────────────────
 LSET stringvariable$ = stringexpression$
 LSET recordvariable1 = recordvariable2
 RSET stringvariable$ = stringexpression$
 
 Usage Notes
   ■ If stringexpression$ requires fewer bytes than were defined for
     stringvariable$ in the FIELD statement, the RSET function right-
     justifies the string in the field; LSET left-justifies the string.
     Spaces are used to pad the extra positions.
 
   ■ If the string is too long for the field, both RSET and LSET truncate
     characters from the right.
 
   ■ Numeric values must be converted to strings before they are justified
     with the RSET or LSET statement.
 
   ■ RSET or LSET can be used with a string variable not defined in a FIELD
     statement to right- or left-justify a string in a given field. The
     following example right-justifies the string N$ in a 20-character
     field:
 
         A$ = SPACE$(20)
         RSET A$=N$
 
   ■ 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
 
     The example above demonstrates:
     • LSET copying record variables of different data types
     • LSET copying only the number of bytes in the shorter of the two record
       variables
     Note: You also can use LSET to copy record variables of the same type.
 
   ■ When RSET is used with a variable-length string, the string is treated
     as a fixed field. The length of the field is the length of the value
     the variable had before the RSET statement.