INSPECT Statement Considerations

IBM Extension
IBM Extension

If any identifiers or literals other than identifier-2 (the count field) are DBCS items, then all of them must be DBCS items.

Identifier-2 cannot be a DBCS item. DBCS characters, not bytes of data, are tallied in identifier-2.

All identifiers, except identifier-2 (the count field), can be external floating-point items. External floating-point items are treated as if redefined as alphanumeric with the INSPECT statement referring to the alphanumeric item.

End of IBM Extension
End of IBM Extension

Except when the BEFORE or AFTER phrase is specified, inspection begins at the leftmost character position of the inspected item (identifier-1) and proceeds character-by-character to the rightmost position.

The operands of the following phrases are compared in the left-to-right order in which they are specified in the INSPECT statement:
  • TALLYING (literal-1 or identifier-3, . . . )
  • REPLACING (literal-3 or identifier-5, . . . )

If any identifier is subscripted, reference modified, or is a function-identifier, the subscript, reference-modifier, or function is evaluated only once as the first operation in the execution of the INSPECT statement.