String concatenation, Arithmetic – IBM SC34-5764-01 User Manual

Page 138

Advertising
background image

blanks and comments. In addition, one or more blanks, where they occur in expressions but are not
adjacent to another operator, also act as an operator. There are four types of operators:
v

Concatenation

v

Arithmetic

v

Comparison

v

Logical

String Concatenation

The concatenation operators combine two strings to form one string by appending the second string to the
right-hand end of the first string. The concatenation may occur with or without an intervening blank. The
concatenation operators are:

(blank)

Concatenate terms with one blank in between

||

Concatenate without an intervening blank

(abuttal)

Concatenate without an intervening blank

You can force concatenation without a blank by using the || operator.

The abuttal operator is assumed between two terms that are not separated by another operator. This can
occur when two terms are syntactically distinct, such as a literal string and a symbol, or when they are
separated only by a comment.

Examples:

An example of syntactically distinct terms is: if Fred has the value 37.4, then Fred'%' evaluates to 37.4%.

If the variable PETER has the value 1, then (Fred)(Peter) evaluates to 37.41.

In EBCDIC, the two adjoining strings, one hexadecimal and one literal,

'c1 c2'x'CDE'

evaluate to ABCDE.

In the case of:

Fred/* The NOT operator precedes Peter. */¬Peter

there is no abuttal operator implied, and the expression is not valid. However,

(Fred)/* The NOT operator precedes Peter. */(¬Peter)

results in an abuttal, and evaluates to 37.40.

Arithmetic

You can combine character strings that are valid numbers (see page 113) using the arithmetic operators:

+

Add

Subtract

*

Multiply

/

Divide

%

Integer divide (divide and return the integer part of the result)

//

Remainder (divide and return the remainder—not modulo, because the result may be negative)

**

Power (raise a number to a whole-number power)

REXX General Concepts

116

CICS TS for VSE/ESA: REXX Guide

Advertising