concatenate()

The vgLib.concatenate() system function concatenates two character variables. When two character variables are concatenated, the following actions occur:
  1. Any trailing spaces or nulls are deleted from the target string.
  2. The source value is appended to the value produced during Step 1.
  3. If the concatenated output is longer than the target parameter, the output is truncated. If the output is shorter than the target parameter, the output is padded with blanks.

vgLib.concatenate() is one of a number of functions maintained for compatibility with earlier versions. New code can use the standard EGL operators for these purposes.

Syntax

  vgLib.concatenate(
    target CHAR | DBCHAR | MBCHAR | UNICODE inOut,
    source CHAR | DBCHAR | MBCHAR | UNICODE in)
  returns (result INT)
target
A character-type variable to which the contents of source are concatenated.
source
A character-type variable, which EGL concatenates to target.
result
One of the following integer values:
-1
Concatenated string is too long to fit in the target field and characters other than nulls or spaces were truncated from the result.
0
Concatenated string fits in the target field.

Example

The following example concatenates two shorter strings:

phrase, ormeme CHAR(7);
result INT;
phrase = "and/  ";
ormeme = "or";
result = vgLib.concatenate(phrase,ormeme);
if (result == 0)
    SysLib.writeStdout("***"+phrase+"***"); // phrase = "and/or "
end

Feedback