Search for text within a string in CL/400

Tags:
AS/400 development
CL
CL/400
String manipulation
Wath function can I use to find a text into other? I mean how caon I find the Position for -B- in the text -AABAA-

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following