|
Bob, >Sounds like you're saying it will work unless someone has a huge text >field, in which case you can change the code, the source is there. Or just change the 4096 and it will work all the time. So why limit it to 4K strings? What are the chances somebody will remember the 4K limitation when the need arises? Service program routines should be set and forget, IMHO, and I don't see any down side to increasing the maximum length of the varying field. Unlike the days of non-varying length character fields and operational descriptors, I don't believe there is any performance hit to making it bigger than 4K maximum size. >VARYING allows you pass in a value of any length without worrying about >the length of the value passed in--its integrated into VARYING, I know that, but here is the catch and you said it yourself: >so long >as it does not exceed the maximum length declared for the variable. So why make an artificial limitation of 4K? >When the number of bytes (parm 2) exceeds the length of the input value, >you simply need to change one line of code and it will work the way "you >expect it to". Just change the RETURN '' line to RETURN InString. First, I originally thought RETURN '' listed an asterisk, not two single quotes. I guess it is time to increase the font size on my monitor from an 8pt font while running 1024x768... However, I don't think I'd be alone in expecting Right() to return what is available when the requested character count exceeds the original string length. >(remember this is RPG IV, not Visual Basic) but as I said, you have the >source, so change it to make it work the way _you_ think it should work. I don't need to; I've had a string handling service program for years which includes much more than Right(). You posted code and asked me if it would work. I simply pointed out it would not work over 4K (and you agree), and we evidently differ in how we think Right() should handle a character count exceeding the string length. To me, returning an empty string would be non-sensical. > Also, remember, I sort of made up the routine as I wrote >it in the email message. I think that is the bottom line. You asked if it would work, and I suggested changes. I didn't say they were rocket science. I just think it makes for a more useful procedure in the generic sense -- which is what I like in service programs. Doug
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.