COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-90
INSPECT TALLYING
2. If no match occurs in the comparison of the first compare-string, the
comparison is repeated with each successive compare-string until either a
match is made or there is no next compare-string. When there is no next
compare-string, the character position in source-string immediately to
the right of the leftmost character position considered in the last comparison
cycle is considered to be the leftmost character position, and the comparison
cycle begins again with the first compare-string.
3. Whenever a match occurs, tallying occurs as described in Tallying. The
character position in source-string immediately to the right of the
rightmost character position that participated in the match is now considered to
be the leftmost character position of source-string, and the comparison
cycle resumes with the first compare-string.
4. The comparison operation continues until the rightmost character position of
source-string has participated in a match or has been considered to be
the leftmost character position. When this occurs, inspection terminates.
5. If the CHARACTERS phrase appears, an implied 1-character operand
participates in the comparison cycle, except that no comparison to the contents
of source-string occurs. This implied character is considered to match the
leftmost character of source-string participating in the current comparison
cycle.
BEFORE and AFTER Phrases
The BEFORE and AFTER phrases affect the comparison operation like this:
1. If no BEFORE or AFTER phrase is present, compare-string or the
operand implied by CHARACTERS participates in the comparison operation.
2. If the BEFORE phrase appears, the associated compare-string or the
operand implied by CHARACTERS participates only in comparison cycles that
involve the portion of source-string from its leftmost character position up
to, but not including, the first occurrence of delim-string. The position of
this first occurrence is determined before the first cycle of the comparison
operation begins.
If, on any comparison cycle, compare-string or the operand implied by
CHARACTERS is not eligible to participate, it is not considered to match the
contents of source-string. If delim-string does not occur within
source-string, its associated compare-string or the operand implied by
CHARACTERS participates in the comparison operation as though the
BEFORE phrase was not specified.