It doesn't look like a COBOL Code. lets have me trial.
First thing can you confirm the length of input string. One thing I noticed here is you are running DO WHILE LOOP for 10 times but the number of digits in the input string are 9. So do you want to try making DO WHILE run for 9 times, if yes probably LT would work in place of LE.
Could you give an expected output for all the four records you shown as an input.