This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. 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.
email@example.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.
Just omitting the length parameter doesn't solve all the cases, for example I have a field that returns the status of an HTTP operation, for example '200 OK' (but if the operation fails - for example the server was down - it returns an empty string). The problem is that not all servers respond with the same text so I only need to test the numeric part.
In my code I would test If %SubSt(Status: 1: 3) = '200' .. but that fails if the string is empty. My work around now is to code If %SubSt(Status + ' ': 1: 3) = '200' but I consider it rather silly code.
Another solution would be If %Split(Status: ' ') = '200' but %Split returns an array :-( Please vote IBMI-I-3265 for allowing an index on the %Split operation, ie. %Split(Status: ' ')(1)
Thank you for taking the time to submit your request, and thank you for providing additional information about the request.
We understand the request, and agree with it in general. Although. we think that in many cases where the length operand for %SUBST is too long, it should have simply been omitted, allowing the %SUBST operation to return the remaining data following the start position. Note that the length operand for %SUBST has always been optional.
After careful consideration, we know that we cannot deliver this enhancement soon, so it is being declined. However, we believe this request may have future value, so we will add it to an internal list for us to keep in mind for the future.
Ah, crap! Thanks.
I get the various SST, SUBST, and SUBSTR (CL, RPG, SQL) substring features mixed up.
In RPG I would like the option to have the LENGTH parameter not generate an error when it causes the SUBST to exceed the right-end of the value.
If EVAL(e) would do it, fine, but it typically occurs on a conditional statement so that wouldn't apply.
For the most part, this is "found bugs" in Legacy code that I come across where it fails "today" for the first time due to the original programmer not checking the LENGTH argument. Probably because it was written before %LEN worked like it does today.
So rather than go in an change this logic in "27 places" I would prefer a Header spec option that simply says, "Keep going" in this context.
Bob, it has always been possible to omit the length operand for %SUBST. If trhe length operand is omitted, the length defaults to the length remaining in the field starting at the start position.
Please verify that this RFE can be closed, since it's easier to just omit the length operand than it would be to add a new keyword about ignoring length errors.
Omitting the Length would be preferred.
But ignoring the length-too-long situation would be nice for existing code. But once we have the ability to omit the length, then that's good enough.
Here's one scenario:
dcl-s workField varchar(255);
dcl-s company varchar(255);
workField = %upper(company);
eval X = %scan(WorkField, 'Q'); // Find first 'Q' in the field
eval target = %SUBST( CompanyName : X+1 : 255); // Read from first 'Q' + 1 to end of field
Please provide a "real-life" scenario where just omitting the length operand wouldn't work just as well as ignoring the length-too-long situation.
Sean and Niels, if you note the detail I added, (a compiler CTL-OPT keyword) that turns it off, it won't break anyone's code.
In fact, I don't see who even if it were just done without a switch to control it, it would break code. Well if you mean "break" by making it continue instead of ending, then yes, I agree, if your code depends on this happening (can't imagine a scenario where it would but so be it) then it would "break" that if you recompiled. Hence, the Switch/Option was asked for.
There has already been raised a RFE for %left() and %right() many years ago.
But Bobs suggestion to lax the check if the position or length exceeds the length of the string using an option like OPTION(*NOLENCHK) is OK.
This is a great RFE.
It is however not only the length but also the position: it try to do a substring to take the first character of a zero length string aka. %SUBST ( '':1:1) then both the length and position causes the exception.
But as @Sean Batson is noticing - if implemented in the the current SUBST it will cause a lot of issues. So may I suggest - perhaps at new set of build-in: %Left, %Right, %Mid
For that reason we have our own strLeft(), strMid(), strRight() functions that implements that for RPG.
This request will break so many products