Not sure if their is a function but here's some code to do it
DCL &pos DEC (3 0)
loop;
chgvar &pos 1
if (%substring(&myvar &pos 1) = 'B') then do...
enddo
else chg var &pos (&pos + 1)
if (&pos < 10) goto loop
Last Wiki Answer Submitted: December 11, 2008 2:11 pm by philpl1jb44,630 pts.
All Answer Wiki Contributors: philpl1jb44,630 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
There is a function – the QCLSCAN API
http://www.redbooks.ibm.com/pubs/html/as400/v4r5/ic2924/index.htm?info/apis/qclscan.htm
and a code exampe at
http://www.code400.com/forum/showthread.php?t=3051