- identifier-2
- The count field. It must be an elementary numeric item defined without
the symbol P in its PICTURE character-string. You must initialize identifier-2
before the INSPECT statement is executed.
- identifier-3 or literal-1
- The tallying operand (the item whose occurrences are tallied) If the
tallying operand is a figurative constant, it is considered to be a 1-character
nonnumeric literal.
When neither the BEFORE nor AFTER phrase is specified, the following actions
take place when the INSPECT TALLYING statement is executed:
- If ALL is specified, the count field is increased by 1 for each non-overlapping occurrence
in the inspected item of this tallying operand, beginning at the leftmost
character position and continuing to the rightmost.
- If LEADING is specified, the count field is increased by 1 for each contiguous non-overlapping
occurrence of this tallying operand in the inspected item, provided that the
leftmost such occurrence is at the point where comparison began in the first
comparison cycle for which this tallying operand is eligible to participate.
- If CHARACTERS is specified, the count field is increased by 1 for each character (including
the space character) in the inspected item. Thus, execution of the INSPECT
TALLYING statement increases the value in the count field by the number of
characters in the inspected item.