How can I manipulate a string in RPG?

352580 pts.
Tags:
RPG
String manipulation
I know this might sound like a "beginner" question but I know most of the time strings in RPG have a fixed length (but more importantly, have a finite length). But I'm pretty much lost on how to write a procedure for string manipulation.

How can I write a procedure that takes care of a string of whatever length? Can I use this:
text = manip_str(text);
Would it work with all different lengths? Any help would be greatly appreciated.

Answer Wiki

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

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
  • TomLiotta

    Yes, a procedure could be defined to handle a string of any valid length. A description of what the procedure needs to do is needed, though. Also, because your example shows that 'text' is used as both the input parameter and the return values, it seems unlikely that you'd want to do this with fixed-length strings. Just from appearances, you should probably be using variable-length strings instead.

    So while it's true that "most of the time" strings are fixed-length in RPG, you almost certainly wouldn't use one in this kind of case. The fixed-length strings generally come out of the record oriented data that RPG was designed to process. Such strings are rarely meaningful in "text manipulation" scenarios. Use definitions that are appropriate to the task.

    Tom

    125,585 pointsBadges:
    report

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