VMS Help
COBOL, PROCEDURE_DIVISION, INSPECT, 2format REPLACING

 *Conan The Librarian

  The INSPECT statement counts or replaces occurrences of single
  characters or groups of characters in a data item.

  Format 2 -

  INSPECT src-string REPLACING

    { CHARACTERS BY replace-char [{ BEFORE } INITIAL delim-val] ... }
    {                            [{ AFTER  }                  ]     }
    { { ALL     }                                                   } ...
    { { LEADING } { compare-val BY replace-val
    { { FIRST   }

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

  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 - 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.

  3 - delim-val

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

  4 - replace-char

  is the one-character item that replaces all characters.  Its content
  restrictions are the same as those for compare-val.

  5 - replace-val

  is the character-string that replaces occurrences of compare-val.
  Its content restrictions are the same as those for compare-val.
  Close     Help