InfoSphere Optim

 View Only
Expand all | Collapse all

Example optim.mask() with LUA using lookup function Optim LUW

  • 1.  Example optim.mask() with LUA using lookup function Optim LUW

    Posted Tue January 15, 2019 02:49 PM
    Hi, 

    does any one have an example on how to call the optim.mask(with Optim Data Privacy LOOKUP) from LUA in Optim LUW?

    Documentation is not quite clear, or perhaps i haven't found the right one :)

    I want to send a variable as the source value and get it back as variable.
    Then i will do some more concatenation before setting the column value for the target.

    I want to use it direct from Optim classic by putting it in to a column map procedure.
    (We don't have the designer installed) I have manage to execute LUA code this way by exporting the column map procedure, edit the script (Remove all capitals on reserved words like String etc) and then import it again.

    best regards, 
    Per

    ------------------------------
    Per Wallqvist
    ------------------------------

    #InfoSphereOptim
    #Optim


  • 2.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Wed January 16, 2019 07:08 AM
      |   view attached
    ​I have a failed example from a few years ago for masking a Brazil NID. Is commented out towards the end.

    That was the only LUA we wrote, for the two Brazil NIDs.


    ------------------------------
    Ed Lipson
    BNYMellon
    Brooklyn NY
    718 315 4763
    ------------------------------

    Attachment(s)

    txt
    CNPJ_Random.lua.txt   6 KB 1 version


  • 3.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Thu February 07, 2019 03:35 AM
    Hi Ed and thanks for your help.

    We are still struggling and will rase a PMR to get more clearity in how and if the lookup funktion works when calling using optmmask() funktion from lua and a CMP in Optim LUW

    So i still look for more answers if someone got any input on this.

    Cheers, 
    Per

    ------------------------------
    Per Wallqvist
    ------------------------------



  • 4.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Fri February 08, 2019 02:45 AM
      |   view attached
    I have attached some sample LUA scripts and let me know if you need any clarifications I should be able to help you.
    Many of Optim customers making use similar use cases.

    ------------------------------
    Tulasi Uppu
    ------------------------------

    Attachment(s)

    zip
    LuaScripts.zip   5 KB 1 version


  • 5.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Fri February 08, 2019 05:07 AM
    Hello Per,

    I would recommend to review the Lookup provider documentation on the below link. It has details on how to create the parameter string required for lookup function and use it inside optimmask() function
    https://www.ibm.com/support/knowledgecenter/en/SSMLQ4_11.3.0/com.ibm.nex.designer.doc/oxy_ex-1/com.ibm.nex.mod.doc/topics/opmod-c--lookup_providers.html


    ------------------------------
    Thanks,
    Ankur Agrawal
    ------------------------------



  • 6.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Thu April 25, 2019 03:28 PM
    Has the OP or anyone else actually been able to perform a HASH_LOOKUP from a LUA script using Optim Classic?

    I have not been able to get any of the samples given in this thread to work nor have I been able to get anything to work using the existing documentation.  


    ------------------------------
    Tammy Forlenza
    ------------------------------



  • 7.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Fri April 26, 2019 03:09 AM
    Try the Below sample Code :

    Line1 = 'pro=hash_lookup, hashfld="SEQ_KEY", '
    Line2 = 'source="FIRST_NM", rep="FNAME_UPPER", '
    Line3 = 'id=STDM_LOOKUP.NAME_MASK_LOOKUP, lib=ORACLE, conn=<DB_NAME>, '
    Line4 = 'user=<LOOKUP_USERID>, pass="<LOOKUP_TBL_PWD>", '
    Line5 = 'flddef1=(name=FIRST_NM, dt=wvarchar_sz), '
    Line6 = 'flddef2=(name=FNAME_UPPER, dt=wvarchar_sz)'
    mask_parms_hash = Line1..Line2..Line3..Line4..Line5..Line6
    maskfxname1 = optim.mask(fxname1, mask_parms_hash)  fxname1 is the Source, where the data to be masked
    optim.target.setcolumnvalue(maskfxname1)

    We use Designer to update the PROC. But now sure , if it works directly with Classic flavor. But this is the way to use LOOKUP in LUA.

    Thanks,
    Joseph R

    ------------------------------
    Joseph Jeba Kumar Ravindran
    ------------------------------



  • 8.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Fri April 26, 2019 09:43 AM

    Joseph,

    Thanks for the help.  It could possibly be a Classic issue. 
    The problem is in the parameters as best I can tell. It seems there may be some truncation occurring.  I get the below error about FLDDEF missing when it is there.  However, if I shift the parameters around so that FLDDEF is in the front, then another parameter at the end of the string is reported missing.

    User DLL or Proc requested termination while processing
    XXXXXXX.YYYYYYY.OPTIM_CUSTOMERS
    Column Map Procedure set on column CUSTNAME encountered an error at line 18
    while processing row 1: optimmask: Parser_Service: ODPP Parser: IOQDP3060E: The
    mandatory parameter FLDDEF was not found.



    This is what the parameter string looks like.

    stat_parm = ''PRO=HASH_LOOKUP,SRC=CUSTNAME,HASHFLD="SEQ_KEY",''
    stat_parm = stat_parm .. ''REP="CNAME_FIRST_PROPER",''
    stat_parm = stat_parm .. 'lib=DB2LUW,'
    stat_parm = stat_parm .. 'conn=FEDSEVR,'
    stat_parm = stat_parm .. 'user=<user_id>,'
    stat_parm = stat_parm .. ''pass="xxxxxxxxxx",''
    stat_parm = stat_parm .. ''FLDDEF1=(NAME=CUSTNAME,DT=wchar),''
    stat_parm = stat_parm .. ''FLDDEF2=(NAME=CNAME_FIRST_PROPER,DT=wchar),''
    stat_parm = stat_parm .. ''id=<schema>.NAME_MASK_LOOKUP''

    I was hoping to find a solution here before submitting a PMR. 

    Thanks,

    Tammy



    ------------------------------
    Tammy Forlenza
    ------------------------------



  • 9.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Fri April 26, 2019 10:33 AM
      |   view attached
    Hi Tammy,

    Try the attached one.

    Regards,
    Fritz

    ------------------------------
    FRIEDRICH PFNEISL
    Optim SME
    Austria
    ------------------------------

    Attachment(s)

    TXT
    Tammy.TXT   1 KB 1 version


  • 10.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Mon April 29, 2019 11:27 AM
    Edited by System Fri January 20, 2023 04:28 PM
    Hi Fritz, 

    Okay, after a bit of fiddling I was able to get this to work.  The Len parameter for the flddef made all the difference.

    Thanks for your help.

    Tammy

    ------------------------------
    Tammy Forlenza
    ------------------------------



  • 11.  RE: Example optim.mask() with LUA using lookup function Optim LUW

    Posted Tue May 28, 2019 09:31 AM
    Hi Fritz and Tammy, 
    can you post the Lua procedure correctly formatted? because I can't run hash_lookup on a db oracle table.

    Then I have some doubts:
    -user: is the user access to the db oracle or ad optim?
    -conn: is the name of the dbalias or the connection string that I put in tnsnames.ora?
    -lib: in my case should I insert 'ORACLE'?

    Thanks for your help.

    Giuseppe

    ------------------------------
    Giuseppe Cotugno
    ------------------------------