× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 15-Aug-2016 13:15 -0700, Booth Martin wrote:
Methinks there is a better way than what I am doing.

I have a string like "home/One/Two/sample.txt" and want to separate
it as two strings: "home/One/Two/" and "sample.txt". I will be doing
this in an SQLRPGLE program.

Suggestions on approach to this?

FWiW: If the %scanr() BIF is not available yet on your installed release, and if the SCAN OpCode or %scan() BIFs are not desirable for some reason, then if the ILE COBOL compiler is available, that language has a REVERSE function for character string data. While there would be more upfront processing, the reversed data probably would allow for the code to look much cleaner than scanning forward through the data or resorting to a [similarly clean but] by-character loop from the last character.

From a past discussion thread with "Subject: SQL Reverse Function", the referenced CBLLE example, IIRC, could be utilized [effectively: reversed_string=reverse_string(original_string);] to reverse the string to allow %scan() to perform as an effective %scanr():
[http://archive.midrange.com/midrange-l/201312/msg00654.html]
[http://archive.midrange.com/midrange-l/201312/msg00797.html]


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.