COBOL Manual for TNS and TNS/R Programs
Source Text Manipulation
HP COBOL Manual for TNS and TNS/R Programs—522555-006
10-10
REPLACING Phrase
3. If no match occurs, the compiler repeats the comparison with each successive
pseudo-text-1, identifier-1, word-1, or literal-1, if any, in the
REPLACING phrase until a match occurs or until it has compared each
operand in the phrase to the leftmost library text-word or text-words.
4. If the compiler compares all the REPLACING phrase operands without finding
a match, it copies the leftmost library text-word into the source program. Then
the compiler uses the next successive library text-word as the leftmost text-
word and starts the comparison cycle again with the first pseudotext-1,
identifier-1, literal-1, or word-1 in the REPLACING phrase.
5. Whenever a match occurs between pseudo-text-1, identifier-1,
literal-1, or word-1, the compiler copies the corresponding pseudo-
text-2, identifier-2, literal-2, or word-2 into the source program.
The compiler places the text-words into the program according to the rules of
the reference format specified in the COPY statement or, if not specified, the
reference format active before the statement. Then the compiler uses the
library text-word immediately following the matching library text as the leftmost
text-word and starts the comparison cycle again with the first pseudo-text-
1, identifier-1, literal-1, or word-1 in the REPLACING phrase.
6. The comparison operation ends after the rightmost text-word in the library text
participates either in a match or as a leftmost text-word in a complete
comparison cycle.
•
Comment Lines in Replacement Text
The compiler copies any comment line in pseudo-text-2 into the source
program unchanged.
•
Debugging Lines
You can put debugging lines in library text and in pseudo-text-2 or in pseudo-
text-1. Text-words within a debugging line participate in the comparison cycle as
though the indicator area did not contain a D or d.
If a portion of the library text is replaced by a pseudo-text-2, any text-words of
the replacement text specified on debugging lines appear on debugging lines in the
resulting source text.
If a portion of the library text that begins on a debugging line is replaced, all text-
words of the replacement text appear on debugging lines in the resulting source
text.
If library text specified on debugging lines is copied without replacement, it appears
on debugging lines in the resulting source text.
A debugging line cannot contain embedded SQL/MP or SQL/MX statements.