Concatenation operators

Concatenation operators combine two terms into one. The terms can be strings, variables, expressions, or constants. Concatenation can be significant in formatting output.

The operators that indicate how to join two terms are as follows:
Operator
Meaning
blank
Concatenates terms and places one blank between them. If more than one blank separates terms, this becomes a single blank. For example:
SAY true blue /* result is TRUE BLUE */
||
Concatenates terms with no blanks between them. For example:
(8 / 2)||(3 * 3) /* result is 49 */
abuttal
Concatenates terms with no blanks between them. For example:
per_cent'%' /* if per_cent = 50, result
is 50% */
You can use abuttal only with terms that are of different types, such as a literal string and a symbol, or when only a comment separates two terms.

Using concatenation operators

One way to format output is to use variables and concatenation operators as in the following example.
Figure 1. Example Using Concatenation Operators

/****************************** REXX *********************************/
/* This program formats data into columns for output.                */
/*********************************************************************/
sport = 'base'
equipment = 'ball'
column = ' '
cost = 5

SAY sport||equipment column '$'
cost
The result of this example is:
baseball         $5
A more sophisticated way to format information is with parsing and templates. See Parsing data.
Note: The following characters might display differently in the REXX online help depending on the code page used in your emulator configuration: @ # $ ¢. See also Conventions and terminology used in the CICS documentation.