Figure description: INSPECT statement

This figure illustrates processing steps for the following INSPECT statement:


INSPECT ID-1 TALLYING ID-2 FOR ALL "**" REPLACING ALL "**" BY ZEROS.
  1. Initial data values are shown as follows:
    • ID-1, which is a data item of category alphanumeric, contains ***0**
    • ID-2, which is a numeric data item, contains 0
  2. The INSPECT statement scans ID-1 left to right.
  3. The first occurrence of "**" is found at the start of ID-1. The characters "**" are replaced by "00". The counter, ID-2, is incremented by 1.
  4. The next occurrence of "**" is found at the end of ID-1. Again "**" is replaced by "00" and the counter is incremented.
  5. INSPECT statement processing ends. Data values are as follows:
    • ID-1 contains 00*000
    • ID-2 contains 2

End of figure description.