Character string expressions

The operands in a character string expression must be quoted or unquoted character strings, character variables, or the substring (%SUBSTRING or %SST) built-in function.

The value associated with each variable or built-in function must be a character string. The result of concatenation is a character string.

There are three operators that can be used in character string expressions. These operators concatenate (or join) two character strings, but each has a slightly different function. They are:

*CAT (concatenation, symbol ||) operator

The *CAT operator concatenates two character strings. For example: ABC *CAT DEF becomes ABCDEF

Blanks are included in the concatenation. For example: 'ABC ' *CAT 'DEF ' becomes 'ABC DEF '

*BCAT (concatenation with blank insertion, symbol |>) operator

The *BCAT operator truncates all trailing blanks in the first character string; one blank is inserted, then the two character strings are concatenated. Leading blanks on the second operand are not truncated. For example: ABC *BCAT DEF becomes ABC DEF 'ABC ' *BCAT DEF becomes 'ABC DEF'

*TCAT (concatenation with trailing blank truncation, symbol |<) operator

The *TCAT operator truncates all trailing blanks in the first character string, then the two character strings are concatenated. All leading blanks on the second operand are not truncated. For example: ABC *TCAT DEF becomes ABCDEF 'ABC ' *TCAT DEF becomes 'ABCDEF' ABC *TCAT ' DEF' becomes 'ABC DEF' 'ABC '*TCAT ' DEF' becomes 'ABC DEF'

All blanks that surround the concatenation operator are ignored, but at least one blank must be on each side of the reserved value operator (*CAT, *BCAT, or *TCAT). If multiple blanks are wanted in the expression, a quoted character string (a character string enclosed within apostrophes) must be used.

Related reference
Character string