I’m trying to use the INSPECT clause to see if a name (PIC X) contains a certain substring.
When I use
INSPECT NAME TALLYING COUNTER FOR ALL "lee"
The program works as expected,
When I replace the “lee” with a variable the command doesn’t find anything.
...
WORKING-STORAGE SECTION.
01 ZOEKTERM PIC X(40).
...
MOVE "lee" TO ZOEKTERM
INSPECT NAAM TALLYING COUNTER FOR ALL ZOEKTERM
Can anyone explain why this is happening and what I can do about it?
The fix is to explictly specify the length.