TYPE SET statement

Purpose | Assign the value of a User-Defined Type or byte string expression into another User-Defined Type variable.
Syntax | TYPE SET typevar = {typevar | ByteStringExpr$} [USING ustring_expression]
Remarks | TYPE SET is primarily designed to assign the value of a User-Defined Type (UDT) to a different class of User-Defined Type. Additionally, TYPE SET can be used to assign a string expression (ByteStringExpr$) to a UDT, though it is generally not appropriate to assign a wide Unicode string.
USING | Any Byte positions remaining after the assignment are filled (padded) in the target typevar with the first character of the USING string expression, or binary zeros if not specified.
See also | CSET, CSET$, LET (with Types), LSET, LSET$, RSET, RSET$, TYPE/END TYPE

Example

TYPE udt1

x AS STRING * 12

y AS LONG

z AS INTEGER

END TYPE

TYPE udt2

a(1 TO 18) AS BYTE

END TYPE

FUNCTION PBMAIN

DIM u1 AS udt1

DIM u2 AS udt2

u1.x = "ABC"

TYPE SET u2 = u1

a$ = CHR$(u2.a(1), u2.a(2), u2.a(3))

TYPE SET u2 = "1" USING "2"

b$ = CHR$(u2.a(1), u2.a(2), u2.a(3))

END FUNCTION

Result | a$ contains "ABC" b$ contains "122"