× 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 19-Dec-2013 07:42 -0800, Gad Miron wrote:

Is there a SQL (scalar) function to reverse a string like in
Select name, reverse(name) from myFile
result:
abc, cba

Easy enough to code one in just about any language and then issue a CREATE FUNCTION (external) to provide the interface to the executable to your SQL request [or write it directly in SQL; though probably not in a very efficient manner], but FWiW:

While REXX has a REVERSE scalar and can implement a SQL External Stored Procedure, there is no support for INOUT or OUT parameters with a REXX SP, so even though a SQL UDF could effect the CALL to a REXX performing the REVERSE [per lack of an ability for LANGUAGE REXX on an External User Defined Function], there is no direct ability to use its scalar.

The COBOL however does have a "REVERSE function" for which a module in a service program or a bound CBLLE program could externalize the capability to the SQL as a UDF:
<http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rzasb/sc092539948.htm>
IBM i 7.1 Information Center -> Programming -> Programming languages -> COBOL -> ILE COBOL Language Reference -> Procedure Division -> _Intrinsic Functions_
" _REVERSE_

The REVERSE function returns a character string that is exactly the same length as the argument, whose characters are exactly the same as those specified in the argument, except that they are in reverse order.
..."

FWiW there is an example of such a procedure here:
http://www.code400.com/forum/archive/index.php?t-9943.html
Author: Mercury December 17th, 2010, 11:03 AM
"I wrote a Cobol function using the Cobol Built-in FUNCTION REVERSE() many moons ago..."


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.