Free Downloads

Code snippets, shortcuts, wrappers, and other useful tools
for IBM i developers. Enjoy!

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.

Download SQLSCALAR Service Program Library

Check out the article at IT Jungle.

Please note that these are not supported products - 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 PURPOSE 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.

More Downloads

Explore SiD's other free downloads related to RDi, RPG, externalizing database processing, SQL, and more!

More Free Downloads

SiD Services & Events

Custom Training

As the SiD team or as individuals, Susan Gantner and Jon Paris offer a wide range of custom services to help you leverage key IBM i technologies in your unique environment.

Deep Dive Workshops

Take a giant leap forward in one of today's critical IBM i development skills. These live workshops offer a half day of in-depth learning with practical code examples and handouts to continue using as a reference.

Summit Lunch & Learn

Available free through April 30, 2024, these 75-minute sessions cover technical tips and IBM i development tool demos. Featuring Susan Gantner, Jon Paris, and their ISV guests.