The TRANSFORM statement is used to alter characters according to a transformation rule.
- Identifier-3 can be any elementary item except a numeric item with USAGE other than DISPLAY, or a group item.
- Identifier-1 and identifier-2 must be elementary alphabetic or alphanumeric items.
- Nonnumeric-literal-2 or identifier-2 must be either one character long or the same length as nonnumeric-literal-1 or identifier-1.
- The use of figurative-constant-1 and/or figurative-constant-2 is equivalent to the use of a single-character nonnumeric literal
with the same value.
- If either identifier-1 or identifier-2 references the same computer storage area as identifier-3, the result of the TRANSFORM
is undefined. (See the topic
The REDEFINES Clause .)
- If characters are repeated in nonnumeric-literal-1 or identifier-1, then the result of the TRANSFORM operation is undefined.
- The TRANSFORM statement scans identifier-3 for occurrences of individual characters from identifier-1 or nonnumeric-literal-1.
When a match is found, the corresponding character (or the single character of a one-character field) from identifier-2 or
nonnumeric-literal-2 is substituted into that character position in identifier-3. The correspondence between identifier-1
or nonnumeric- literal-1 and identifier-2 or nonnumeric-literal-2 is by occurrence number of the character within the data
item (starting from the left).