COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-95
INSPECT
INSPECT
INSPECT scans a data item and counts and/or replaces occurrences of a single
character or groups of characters.
INSPECT TALLYING
INSPECT TALLYING counts occurrences of a sequence of one or more characters in a
source string.
source-string
is the identifier of an elementary item or data structure with USAGE DISPLAY.
Inspection proceeds from left to right within source-string.
tallying-phrase
tally
is the identifier of an elementary numeric item where the number of
occurrences is to be stored. The INSPECT statement does not initialize tally
but adds to its current value. If you want tally to begin at a given number,
set it before the INSPECT statement executes.
Form Description
INSPECT TALLYING
Counts occurrences of a character sequence in a
source string
INSPECT REPLACING
Replaces occurrences of a character sequence in a
data item with a specified value
INSPECT TALLYING REPLACING
Counts occurrences of a character sequence in a data
item and replaces each occurrence with a specified
value
INSPECT CONVERTING
Performs a character-for-character replacement
INSPECT source-string tallying-phrase
VST164.vsd
FORtallyTALLYING for-clause
VST165.vsd