concatenate()

The system function StrLib.concatenate concatenates two strings.

  StrLib.concatenate(
    target a character type inOut,
    source a character type in)
  returns (result INT)
result
Numeric field that receives one of the following values (defined as type INT or the equivalent: type BIN with length 9 and no decimal places) returned by the function:
-1
Concatenated string is too long to fit in the target field and the string was truncated, as described later
0
Concatenated string fits in the target field
target
Target field
source
Source field or literal

When two strings are concatenated, the following occurs:

  1. Any trailing spaces or nulls are deleted from the target string.
  2. The source string is appended to the string produced by the previous step.
  3. If the output produced by the second step is longer than the target string field, the output is truncated. If the output is shorter than the target field, the output is padded with blanks.

Example

  phrase = "and/  "; // CHAR(7)  
  or     = "or";
  result = 
    StrLib.concatenate(phrase,or);
  if (result == 0)
    print phrase;  // phrase = "and/or "
  end

Related reference
EGL library StrLib

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.