This portal is to open public enhancement requests against IBM Z Software products. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).
We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:
Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,
Post an idea.
Get feedback from the IBM team and other customers to refine your idea.
Follow the idea through the IBM Ideas process.
Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.
IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.
ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.
This has been delivered in a PTF to the 5.3 compiler via the new SUBTO built-in function
We will do this, probably as SUBTO
I was always wondering if the usage of builtin functions has relevant performance benefits over "selfwritten" funcs.
And why there are no "c-standard-library-equivalents" are available for pl/i.
Maybe someone can comment on that?
Not knowing the above, i workarounded a situation similar to the thread-starter by writing my own function, any comments on that?
substr_foo: proc(str, start, end) returns(char(100) var);
dcl str char(*);
dcl (start,end) bin fixed(15);
return(substr(str, start, (end-start+1) ) );
end substr_foo;
br johann
I just thought of a slightly different use of the optional argument which might be more palatable. In my original example, I specified a '1' in a fourth argument to indicate the third argument was an ending position, not a length.
A better approach would be to have the fourth argument be the ending position, not an indicator. So a user could call SUBSTR as it exists now to indicate length:
MyNewString = substr(MyOldString,12,10)
Or, they could call it with an optional argument to indicate the ending position:
MyNewString = substr(MyOldString,12,,21)
If the optional argument was present, it would take precedence over the third argument.
Again, if IBM prefers a new function, that is fine with me.
It's perfectly fine to introduce a new function if that is preferred over an optional argument to SUBSTR, although there is precedence for an optional argument. INDEX started out with two arguments and grew to 3 arguments the last being the starting position which was added years later and is optional.
If you want to introduce a new function, the name SUBTO works for me. It's a shorter name than SUBTHRU, less typing and more room on the line for code.
changing the status to "need more information" until my questions are answered
I think it would indeed be useful to have this ability, but I'm not a fan of providing it via an extra option. Would having an alternately named built-in function be ok? and if so, we're open to suggestions for names. Perhaps it could be SUBTHRU or SUBTO or ??