InfoSphere Optim

 View Only
  • 1.  LUA scripting for Z/OS Optim 11.7

    Posted Mon November 14, 2022 09:36 PM
    I have some business requirement to modify the employee's name into various formats. I am trying to customise using LUA scripting. Below is my LUA script

    function cm_starttable()
    count = 0
    tparm = 'PRO=HASH_LOOKUP,HASHFLD="SEQ",SRC="FIRST_NAME",'
    tparm = tparm .. 'DEST="FIRST_NAME",REPLACE="FIRSTNAME",'
    tparm = tparm .. 'CONN="DBCONN",USER=USER,PASS=PASSWORD,'
    tparm = tparm .. 'lib=DB2ZOSSQL,'
    tparm = tparm .. 'id="OPTIM.OPT_AU_FIRSTNAME_F",'
    tparm = tparm .. 'FLDDEF1=(NAME="FIRST_NAME_SRCH",DT=CHAR,len=30)'
    end


    function cm_transform()
    count = count+1
    a=optim.source.getcolumnvalue("FIRST_NAME")
    print("Processing column " .. source.column.getname())
    print("Type: " .. source.column.gettype())
    print(" Length: " .. source.column.getlength())
    print("a: "..a)
    print("tparm :" .. tparm)
    fname= optim.mask(a,tparm)
    optim.print("first name:" .. fname)
    optim.target.setcolumnvalue("FIRST_NAME",fname)
    end

    function cm_endtable()
    msg = count ..' rows matched the criteria'
    print(msg)
    end

    however, I see below error when I execute the conversion.

    CM PROCEDURE aborted with the following error:
    DB.PERSONAL_DATA(FIRST_NAME): Column: FIRST_NAME:
    Error in Column Map procedure or expression: while executing
    cm_transform(): 17: Lookup Provider failed to initialize. A (re)BIND
    of ODPP DBRM is required

    Please let me know what is wrong with the code or installation.



    ------------------------------
    Sampath Gelli
    ------------------------------

    #InfoSphereOptim
    #Optim


  • 2.  RE: LUA scripting for Z/OS Optim 11.7

    Posted Tue November 15, 2022 01:54 AM
    Hi Sampath,

    If you are running this code natively on z/OS, Optim Data Privacy should use the embedded SQL interface. You don't need the following line in your code.  
    tparm = tparm .. 'CONN="DBCONN",USER=USER,PASS=PASSWORD,'
    Please refer the link for details - https://www.ibm.com/support/pages/using-lua-optim-zos-run-lookup-functions-using-optimmask-function-call

    Also as per the error message, I guess you might need to rebind the ODPP DBRM is required. I dont have much insight on the same.

    Thanks,
    Ankur Agrawal


    ------------------------------
    Ankur Agrawal
    ------------------------------



  • 3.  RE: LUA scripting for Z/OS Optim 11.7

    Posted Tue November 15, 2022 10:48 AM
    Hi Sampath,

    The Hash lookup function requires at a minimum two field definitions to bind with.  One for the input value (the source column) and one for each of the output variables. In your case just one for the first name.  You will need to add a field definition. It may look something like;

       tparm = tparm .. ',FLDDEF2=(NAME="FIRSTNAME",DT=CHAR,len=30)'

    Make sure the data type and length matches the lookup tables type and size for FIRSTNAME.

    ------------------------------
    Tammy Ziegler
    ------------------------------



  • 4.  RE: LUA scripting for Z/OS Optim 11.7

    Posted Tue November 15, 2022 03:18 PM
    You need to BIND, or re-BIND, ODPP DBRM packages with the Optim for z/OS plan.
    See https://www.ibm.com/support/pages/node/545031

    Sample BIND job can be found in member IOQBIND, in the ODPP AIOQSAMP library.

    ------------------------------
    Gregory Czaja
    ------------------------------