REPLACE Statement
The REPLACE statement is used to replace source program text.
The REPLACE statement can occur anywhere in the source program where a character-string can occur. It must be preceded by a separator period except when it is the first statement in a separately compiled program. It must be terminated by a separator period.
The REPLACE statement resembles the REPLACING phrase of the COPY statement, except that it acts on the entire source program, not just the text in COPY libraries.
- The next occurrence of the REPLACE statement
- End of the program
- REPLACE OFF (see Format 2 below)
- pseudo-text-1, pseudo-text-2
- Pseudo-text is
a sequence of text words, comment lines, or separator spaces bounded
by, but not including, the pseudo-text delimiter (==).
Pseudo-text-1 must contain at least one text word other than a separator comma or separator semicolon. Beginning and ending spaces are not included in the text comparison process, and multiple embedded spaces are considered to be a single space.
Pseudo-text-2 does not need to contain a text word; it may consist solely of space characters and/or comment lines.
Since pseudo-text-1 requires a text word, which must be bounded by separators, pseudo-text cannot be used to replace part of a data name (for example, a prefix); the entire data name must be used.
IBM ExtensionIBM Extension Pseudo-text-1 or pseudo-text-2 can contain DBCS or national character-strings. Such pseudo-text cannot be continued across lines. End of IBM Extension
End of IBM ExtensionIBM ExtensionIBM Extension When a REPLACE statement is in effect, there are certain restrictions on the layout of a Format 2 - DDS Translate COPY statement. (See COPY Statement - Format 2 - DDS Translate.) End of IBM Extension
End of IBM Extension
REPLACE statements are processed after all COPY statements have been processed. The text that results from the processing of a REPLACE statement must not include a REPLACE statement.