I’m not sure I really understand your question. The text asks to check for a particular character (‘D’) but then you reference the CHECK built-in which checks for the absence of a character and SCAN which locates the first occurrence of the character. Assuming that what you want is “check a particular character in a string variable” then:
01 WS-String PIC X(10) VALUE "GOOD DAYYY".
01 Number-Found PIC S9(9) BINARY VALUE 0.
INSPECT WS-String TALLYING Number-Found FOR ALL "D".
should do the trick. After the INSPECT if Number-Found = 0 then no “D” was found. If Number-Found is > 0 then that is the number of “D” occurences within WS-String.
Note that Number-Found needs to be re-initialized prior to each INSPECT.
The documentation for INSPECT can be found in the ILE COBOL Language Reference in the i5/OS Information Center.