VMS Help
COBOL, PROCEDURE_DIVISION, INSPECT, 3format TALLYING REPLACING
*Conan The Librarian
|
The INSPECT statement counts or replaces occurrences of single
characters or groups of characters in a data item.
Format 3 -
INSPECT src-string TALLYING
{
{ tally-ctr FOR
{
{
{ [ { BEFORE } ] } }
{ CHARACTERS [ { AFTER } INITIAL delim-val ] ... } ... } ...
{ { ALL } {
{ { LEADING } { compare-val
{
[{ BEFORE } ] } } }
[{ AFTER } INITIAL delim-val ] ... } ... } ... } ...
REPLACING
{ CHARACTERS BY replace-char [{ BEFORE } INITIAL delim-val] ... }
{ [{ AFTER } ] }
{ { ALL } } ...
{ { LEADING } { compare-val BY replace-val
{ { FIRST }
[ { BEFORE } INITIAL delim-val ] ... } ... }
[ { AFTER } ] } }
is the identifier of a group item or an elementary data item with
DISPLAY usage. INSPECT operates on the contents of this data item.
is the identifier of an elementary numeric data item.
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.
is the character-string that delimits the INSPECT operation. Its
content restrictions are the same as those for compare-val.
is the one-character item that replaces all characters. Its content
restrictions are the same as those for compare-val.
is the character-string that replaces occurrences of compare-val.
Its content restrictions are the same as those for compare-val.