Kilowatt Software's
Classic Rexx Tutorial
Language Level 4.00 (TRL-2)

String concatenation

Rexx has two fundamental string concatenation operators.

  1. concatenation with an intervening space -- space concatenation

  2. concatenation WITHOUT an intervening space -- abuttal concatenation

Space concatenation is performed when two terms are separated by an intervening space.

Here is an example of space concatenation:

In the above example the two magic words were concatenated with an intervening space.

Here is another example of space concatenation:

In the above example the caption and the computation result were concatenated with an intervening space.

Space concatenation is also performed implicitly when an instruction is continued across a line boundary.

Often, you will want to concatenate the values without an intervening space. This is accomplished by adding an abuttal operator, at the front of the lines which follow the first.

There are several methods of performing an abuttal concatenation

  1. using the abuttal operator, which is two vertical bars: ||

  2. concatenation of adjacent terms -- especially when one term is quoted

  3. concatenation of adjacent terms -- when the left term is a function result

  4. concatenation of adjacent terms -- that are separated by a comment that has no surrounding spaces

Here is an example of abuttal concatenation, using the abuttal operator:

In the above example the two magic words were concatenated WITHOUT an intervening space.

Here is an example of abuttal concatenation, when one term is quoted:

Here is an example of abuttal concatenation, when the left term is a function result:

Here is an example of abuttal concatenation, due to a comment between terms:

An elaborate example of the string concatenation is:

The above example used the PARSE instruction
and the following built-in functions;
  CENTER,
  DATE,
  TIME,
  RIGHT,
  SUBSTR


Kilowatt Software's -- Classic Rexx Tutorial -- Back to top
Click here if you have any comments or questions regarding this tutorial

Last updated on: 8 Aug 2002