I wish COBOL had an intrinsic function like RPG's %SCAN. QCLSCAN has a too many parameters. This is the best I could come up. Anybody got anything better?
Look for a decimal point in X-Value.
Look for a decimal point in X-Value.
Code:
01 X-Value pic x(10).
01 P-Ndx pic s9(4) binary.
move zero to P-Ndx
inspect X-Value tallying P-Ndx
for characters before '.'
add 1 to P-Ndx
if P-Ndx > length of X-Value
move zero to P-Ndx
end-if




Comment