qbasic.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
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
LSET and RSET move data into a random-access file buffer (in preparation for
a PUT statement) and left- or right-justify the value of a string variable.
LSET also copies the contents of one record variable to another.
 
LSET stringvariable$=stringexpression$
RSET stringvariable$=stringexpression$
LSET recordvariable1=recordvariable2
 
    ■ stringvariable$      Any string variable or a random-access file field
                           defined in a FIELD statement.
    ■ stringexpression$    For LSET, the left-justified version of
                           stringvariable$. For RSET, the right-justified
                           version of stringvariable$.
    ■ recordvariable1      Record variables of any user-defined data type.
      recordvariable2      Use LSET to assign a record variable of one data
                           type to a different user-defined data type.
 
Example:
    OPEN "FILEDAT.DAT" FOR RANDOM AS #1 LEN = 10
    FIELD #1, 5 AS Ls1$, 5 AS Rs1$
    LSET Ls1$ = "LSET"
    RSET Rs1$ = "RSET"
    PUT #1, 1
    CLOSE #1
    OPEN "FILEDAT.DAT" FOR RANDOM AS #1 LEN = 10
    FIELD #1, 5 AS Ls2$, 5 AS Rs2$
    GET #1, 1
    PRINT "*" + Ls2$ + "*", "*" + Rs2$ + "*"
    CLOSE #1
 
See Also    FIELD    GET, PUT