concatenateBytes()

The system function VGLib.concatenateBytes concatenates two fields.

As is true in StrLib.concatenate, the source and target may be of a character type. In the current function, the source also may be any of the following types:
  StrLib.concatenateBytes(
    target a character type  inOut,
    source BIN, DECIMAL, NUM, NUMC, PACF, or 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 output is too long to fit in the target field and the output was truncated, as described later
0
Concatenated output fits in the target field
target
Target field.
source
Source field or literal.

When two values are concatenated, the following occurs:

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

Example

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

Related reference
concatenate()
EGL library VGLib

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