Joined: 25 Nov 2010 Posts: 70 Location: Sivakasi, India
This is the program :
01 WS-WHOLE PIC IS X(60).
01 WS-COUNTER PIC IS 9(2) VALUE IS 0.
MOVE 'SYKFTSSSSSINF FO FEFK KHE KEFT CASES TO' TO WS-WHOLE.
INSPECT WS-WHOLE TALLYING WS-COUNTER
FOR LEADING 'S' AFTER INITIAL 'T'.
output for this was :
How it scans and take the total count.
I couldnt find it out with the discussion that i had with other people.
Joined: 06 Jun 2008 Posts: 8055 Location: East Dubuque, Illinois, USA
Click on Manuals at the top of the page, find the COBOL Language Reference manual, and read chapter 6.2.21 on INSPECT and 22.214.171.124 on the BEFORE and AFTER specifically.
Although I haven't tested on a machine, I would expect that WS-COUNTER would be 05. The initial 'T' is in byte 5 of the varaible. There are 5 characters 'S' immediately after that 'T' that would qualify as leading.