The INSPECT statement provides the ability to tally (Format 1), replace (Format 2), tally and replace (Format 3)
or convert (Format 4)
occurrences of single characters or group of characters in a data item.
either a group item or
an elementary alphabetic, alphanumeric,
alphanumeric edited, numeric edited
or numeric item described (either implicitly or explicitly) as USAGE IS DISPLAY.
and /;
or one AFTER phrase can be specified for any one ALL, LEADING, CHARACTERS, FIRST
or CONVERTING
phrase.
This restriction does not apply to literal-2 or identifier-4.
or is a function-identifier
, the subscript
or function-identifier
is evaluated only once as the first operation in the execution of the INSPECT statement.
The position of this first occurrence is determined before the first cycle of the comparison operation described in General Rule 12 is begun. If, on any comparison cycle, literal-1, or the implied operand of the CHARACTERS phrase is not eligible to participate, it is considered not to match the contents of the data item referenced by identifier-1. If there is no occurrence of literal-2, in the contents of the data item referenced by identifier-1, its associated literal-1, or the implied operand of the CHARACTERS phrase participates in the comparison operation as though the BEFORE phrase had not been specified.
The position of this first occurrence is determined before the first cycle of the comparison operation described in General Rule 12 is begun. If, on any comparison cycle, literal-1, or the implied operand of the CHARACTERS phrase is not eligible to participate, it is considered not to match the contents of the data item referenced by identifier-1. If there is no occurrence of literal-2, in the contents of the data item referenced by identifier-1, its associated literal-1, or the implied operand of the CHARACTERS phrase is never eligible to participate in the comparison operation.