Monthly Archives: January 2017

Setting the Zend DB DB2 connection’s library list to the user’s library list

Recently a friend ran into this issue. One way to correct this issue is to set the i5_libl option on the db2 connection options ( Another way to do this is by changing the job description associated with the IBM i user profile by using the command CHGJOBD in a 5250 session. You would set the INLLIBL to LIBL (library list) you want to use. Then assign the jobd
(job description) to user profile your connecting with DB2_connect or Zend_DB and the ibmdb2 adapter.

For example:


Then associate this jobd with the user profile

To Debug the issue there are a few DB2 for i services you can call from PHP via SQL and they are:

Clean phone number field with IBM DB2 for i SQL REGEXP_REPLACE

Say you have a phone number in various formats but you just want the numeric characters and all the non-numeric characters removed. Well use the SQL function REGEXP_REPLACE and look for characters with the regular expression [^\d] and replace it with empty character ”. [^\d] is a negated set which means match any characters not in between [^ and ]. \d is a short hand way of saying all digit characters 0-9.



IBM documentation on REGEXP_REPLACE

Online regex tester tool