String Expressions

<string expression>

──┬─────┬─ <string primary> ───────────────────────────────────────────────►
  └─ * ─┘
►─┬──────────────────────────────────────────────────────────────────────┬─┤
  │ ┌◄───────────────────────────┐                                       │
  └─┴─┬─ & ─┬─ <string primary> ─┴─┬──────┬─┬──────────────────────────┬─┘
      └─ / ─┘                      └─ /= ─┘ └─ ON ── <string primary> ─┘

Explanation

The operators in a string expression have the following meanings.

Operator

Meaning

*

Adds an asterisk (*) prefix to the string primary

&

Concatenates two or more strings

/

Concatenates two or more strings and inserts a slash (/) between each string primary

/=

Adds a slash-equal (/=) suffix to the string primary

ON

Inserts the string " ON " between two string primaries.

Note: The word ON is preceded and followed by a blank character.

When the ampersand (&) operator is used to concatenate two or more strings, a new string is created with a length equal to the sum of the lengths of the original strings. The new string is formed by joining a copy of the last string to the end of a copy of the previous string, and so forth, until all strings are concatenated. Therefore, all string concatenation operations are performed from left to right.

String expressions containing at least one string variable can contain up to 1800 characters. A runtime error results from an attempt to create a larger string than is allowed.

The asterisk (*), slash (/), slash-equal (/=) and ON operators are intended to aid in building file titles from strings.

When a string expression is enclosed in parentheses, it becomes a string primary.

Examples

The following two examples illustrate how to use these operators to build file titles.

This example creates the file title SALESJANUARY ON PAK.

STR1:="SALES";
STR2:="JANUARY";
PGMNAME:= STR1 & STR2 ON"PAK";

This example creates the file title SALES/JONES/= ON ABC.

STR1:="SALES";
STR2:="JONES";
PGMNAME:= STR1/STR2/= ON"ABC";