MOVE - String Expression to DIM Field


 

The MOVE string expression to DIM field instruction combines multiple PL/B string operands within a single instruction and places the resulting string in a DIM destination field. The + operator concatenates string operands. The instruction uses the following format:

 

 

[label]

MOVE

({string}+{string}...){sep}{dest}

 

Where:

label

Optional. A Program Execution Label.

string

Required. A string operand permitted by PL/B string-expression syntax. String operands may include DIM data, INIT string data, string literals, and NCHAR data where supported by the expression.

+

Required. Required between string operands. The string concatenation operator. Operand2 is appended to Operand1.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

dest

Required. A DIM Character String Variable that serves as the destination operand.

Flags Affected: EOS

Note the following:

  1. MOVE evaluates the string expression from the source operands and places the resulting string in {dest}. The source operands remain unchanged.

  2.  

     

    MOVE

    ( dFirst + " " + dLast ), dFullName

     

    MOVE

    ( "Account: " + dAccount ), dMessage

     

  3. The + operator performs string concatenation. String operands are concatenated in expression order. Additional parentheses may be used to group nested string expressions.

  4. MOVE evaluates the string expression from the source operands and places the resulting string in {dest}. The source operands remain unchanged.

  5.  

     

    MOVE

    (( dA + dB + dC ), dResult

     

    MOVE

    ( dA + ( dB + dC ) ), dResult

     

  6. When a DIM variable is used as a source operand, only its Logical String participates in the expression. The Logical String begins at the Form Pointed character and continues through the Length Pointed character. Characters before the Form Pointer and characters beyond the Logical Length do not participate.

  7. The complete string expression must begin with an open parenthesis and end with a close parenthesis. Any additional parentheses must be balanced. Nested expressions are evaluated beginning with the innermost parenthesized expression and working outward.

  8. After the string expression is evaluated, transfer into {dest} follows the character-string destination rules. Transfer begins at the first physical character of {dest}. The Form Pointer of {dest} is set to one (1), and the Length Pointer is set to the last character transferred.

  9. If {dest} is too small to contain the complete evaluated string result, characters are transferred until {dest} is full and the EOS Condition Flag is set.

  10.  

     

    MOVE

    ( Key + Null + Key1 ), S$CMDLIN

     

     

    // If Key = "abc", Null is NULL, and Key1 = "xyz",

     

     

    // S$CMDLIN receives "abcxyz".

     

  11. A NULL string operand contributes no characters to a string concatenation expression. Non-NULL operands are concatenated normally. If all operands in the expression are NULL strings, the evaluated result is a NULL string. When the evaluated result is NULL, no characters are transferred to {dest}; the destination Form Pointer is set to zero (0), and the destination Length Pointer remains unchanged. This is the same destination behavior as a normal MOVE of a NULL string to a DIM field.

  12. String literals may be included directly in the expression and are concatenated in the same manner as other string operands.

  13.  

     

    MOVE

    ( "Last Name: " + dLastName ), dOutput

     

  14. String comparison operators produce numeric logical results and are not string-producing operations for this MOVE form. LIKE, REGEX, and NOCASE are structured-logic operators and are not supported as operators in a MOVE string expression.

  15. The instruction may be continued on multiple lines only when the compiler is operating in Sunbelt mode. When the compiler is in ANSI mode, continuation lines are not supported.

  16.  

     

    MOVE

    ( Key +:

     

     

      Key1:

     

     

      +:

     

     

      Data + Data1:

     

     

    ):

     

     

    S$CMDLIN

     

    In Sunbelt mode, the preceding continued statement is valid. The same continuation syntax is rejected in ANSI mode as NON-ANSI format..

 

 

See Also: CALC, MOVE

 



PL/B Language Reference