Tallying and replacing data items (INSPECT)
Use the INSPECT
statement to
inspect characters or groups of characters in a data item and to optionally
replace them.
About this task
Use the INSPECT
statement to
do the following tasks:
- Count the number of times a specific character occurs in a data
item (
TALLYING
phrase). - Fill a data item or selected portions of a
data item with specified characters such as spaces,
asterisks, or zeros (
REPLACING
phrase). - Convert all occurrences of a specific character or
string of characters in a data item to replacement characters that
you specify (
CONVERTING
phrase).
You can specify one of the following data items as the item to be inspected:
- An elementary item described explicitly or implicitly
as
USAGE DISPLAY
,USAGE DISPLAY-1
, orUSAGE NATIONAL
- An alphanumeric group item or national group item
If the inspected item has:
USAGE DISPLAY
, each identifier in the statement (except theTALLYING
count field) must haveUSAGE DISPLAY
, and each literal in the statement must be alphanumericUSAGE NATIONAL
, each identifier in the statement (except theTALLYING
count field) must haveUSAGE NATIONAL
, and each literal in the statement must be nationalUSAGE DISPLAY-1
, each identifier in the statement (except theTALLYING
count field) must haveUSAGE DISPLAY-1
, and each literal in the statement must be a DBCS literal