Year: 2019

Retrieve commands with F8

Write to joblog using SQL

Using INCUDE statement, we can include source to the stored procedure. In this example, we are going to insert C source code which contains the API Qp0zLprintf. Create stored procedure MYPRINTF like below : cl:addlible qsysinc; create or replace procedure mylib.myprintf(printString varchar(500)) set option bindopt = ‘bndsrvpgm(qsys/qp0zcpa)’ begin if printString is not null then include […]

Extract Numbers from a string using SQL

Using regexp_replace function, we can extract numbers from a string. Example : select regexp_replace(‘Nanda has more than 15 years experience in Ibm i’, ‘[^0123456789]’, ‘  ‘, 1, 0, ‘i’) from sysibm.sysdummy1. Result : 15 First parm : Source_String Second Parm : Pattern-expression. [^0123456789] tells the system not to match the numbers. Third Parm :  Replacement […]