RPG/400 Help


String Operations

The string operations include concatenation, scanning, substringing, translation, and verification. String operations can only be used on character fields.

The string operations are:

The CAT operation concatenates two character strings to form one.

The CHECK and CHEKR operations verify that each character in factor 2 is among the valid characters in factor 1. CHECK verifies from left to right and CHEKR from right to left.

The SCAN operation scans a base character string for occurrences of a second specified character string.

The SUBST operation extracts a specified character string from a base character string.

The XLATE operation translates characters in factor 2 according to the from and to strings in factor 1.

Note:
Figurative constants cannot be used in the factor 1, factor 2, or result fields. No overlapping in a data structure is allowed for factor 1 and the result field, or factor 2 and the result field.

In the string operations, factor 1 and factor 2 may have two parts. If both parts are specified, they must be separated by a colon. This option applies to all but the CAT, CHECK, CHEKR, and SUBST operations (where it applies only to factor 2).

If you specify P in position 53 for the CAT, SUBST, or XLATE operations, the result field is padded from the right with blanks after the operation.

See each operation for a more detailed explanation.


[ Top of Page | Previous Page | Next Page | Table of Contents ]