SQLScalar - RPGLE Wrappers for SQL Scalar Functions
SQL Offers a host of powerful scalar functions. Nearly every one of these functions can be "wrapped" in an RPGLE subprocedure
Using an SQL Scalar Function can be a lot easier than the RPG alternative:-
- Use the UPPER function instead of defining two translation strings and using %XLATE
- Use DAYNAME function instead of calculating the day of the week and using an array to provide the day name.
- Using the REGEXP_ functions as opposed to calling the regular expression APIs
- Using the ENCRYPT/DECRYPT functions instead of calling APIs
- Using the SOUNDEX function instead of - well, there is no alternative.
The SQLSCALAR service program contains subprocedure wrappers for the SQL scalar functions ABS, ACOS, ANTILOG, ASCII, ASIN, ATAN, ATAN2, ATANH, BIT_LENGTH, CEIL, CHR, COALESCE, COS, COSH, COT, DATABASE, DAYNAME, DAYOFWEEK, DAYOFWEEK_ISO, DAYOFYEAR, DECRYPT_CHAR, DEGREES, DIFFERENCE, ENCRYPT_AES, ENCRYPT_RC2, ENCRYPT_TDES, EXP, FLOOR, GETHINT, HEX, IFNULL, JULIAN_DAY, LAND, LAST_DAY, LCASE, LEFT, LN, LNOT, LOG10, LOR, LOWER, LPAD, MAX, MIDNIGHT_SECONDS, MIN, MONTHNAME, NEXT_DAY, PI, QUARTER, RADIANS, RAND, REGEXP_COUNT, REGEXP_INSTR, REGEXP_REPLACE, REGEXP_SUBSTR, REPLACE, RIGHT, ROUND_TIMESTAMP, RPAD, SIN, SINH, SOUNDEX, TAN, TANH, TRUNC_TIMESTAMP, TRUNCATE, UCASE, UPPER, VALUE, WEEK, WEEK_ISO and XOR.
The download is a zip file containing a save file (1.9M) of the SQLSCALAR library and a READ_ME document which contains details on how to install and use the service program
Check out the article at IT Jungle
Please note that this is not a supported product - the source of the programs is included and you are free to chop and change them as you wish (see standard disclaimer below). Of course, if you come across any bugs please let us know
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Stay on top of download updates, new freebies and other news. Subscribe to our Email Alerts!
* (required field).