HELPLIB.HLB  —  COBOL  PROCEDURE_DIVISION, INSPECT  1format TALLYING
  The INSPECT statement counts or replaces occurrences of single
  characters or groups of characters in a data item.

  Format 1 -

   INSPECT src-string TALLYING

   {
   { tally-ctr FOR
   {

    {
    {            [ { BEFORE }                   ]            }      }
    { CHARACTERS [ { AFTER  } INITIAL delim-val ] ...        } ...  } ...
    { { ALL     } {
    { { LEADING } { compare-val

                   [{ BEFORE }                   ]     }     }      }
                   [{ AFTER  } INITIAL delim-val ] ... } ... } ...  } ...

1  –  src-string

  is the identifier of a group item or an elementary data item with
  DISPLAY usage.  INSPECT operates on the contents of this data item.

2  –  tally-ctr

  is the identifier of an elementary numeric data item.

3  –  compare-val

  is the character-string INSPECT uses for comparison.  It is a
  nonnumeric literal (or figurative constant other than ALL literal) or
  the identifier of an elementary alphabetic, alphanumeric, or numeric
  data item with DISPLAY usage.

4  –  delim-val

  is the character-string that delimits the INSPECT operation.  Its
  content restrictions are the same as those for compare-val.
Close Help