InfoSphere Optim

 View Only
  • 1.  LUA script is not working in Optim 11.7 Z/OS

    Posted Wed November 16, 2022 10:11 PM
    Hello team -

    I have implemented some code to split the string in LUA in Z/OS for Optim 11.7, I see the same code is getting executed in the online executors but not in Column Map procedures.

    Below is the code snippet
    str="Sampath sam,gelli charan"

    for i,j in string.gmatch(str,"([^,]+),([^,]+)") do
    print (i)
    print(j)
    end

    output in the online editor is  as follows
    Sampath sam
    gelli charan

    but in optim it is nill

    Also, optim is not reconising lua table and it errors when I try to use "[ ]" in LUA scripting.

    Regards,
    sam

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

    #InfoSphereOptim
    #Optim


  • 2.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Wed November 16, 2022 10:35 PM
    You could start with:
    Column map procedures
    Ibm remove preview
    Column map procedures
    A column map procedure is a procedure that is used to mask or transform the data in a source column. You can specify a column map procedure for data transformations in a convert, insert, load, or restore process that are beyond the scope of native column map functions.
    View this on Ibm >

    where it says:

    "Lua chunks attached to Column Map Procedures or CM Expressions may contain certain special characters, or Lua operators, which have different (hexadecimal) code point values depending on the CCSID of the terminal session used to enter the Lua chunk. The Lua compiler embedded in Optim has been configured to correctly interpret Lua chunks entered using EBCDIC CCSID 1047/037 and compatible CCSIDs. Compiler errors may be reported when attempting to process Lua chunks entered using different CCSIDs.

    To prevent such errors, the Optim Lua compiler has been modified to accept a special dedicated comment statement -- LuaSpcChr followed by values to define the representation of certain Lua special characters and operators:

    The -- LuaSpcChr comment line may appear anywhere in the chunk before the first use of any of the characters #\˜ˆ[]{}.

    ...

    ------------------------------
    Greg Czaja
    Optim for z/OS Developer
    ------------------------------



  • 3.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Wed November 16, 2022 10:56 PM
    Hello Greg -

    Thanks for quick response

    I tried with the below code

    a,b=string.find(strName,",")
    -- LuaSpcChr #\[]{}
    s={}
    s[1]="test"

    but I still see the same issue. Am I reading something wrong?


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



  • 4.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Thu November 17, 2022 01:58 AM
    Hi Sampath,

    Some IBM 3270 emulators do not recognize square bracket characters as there is not a consistent definition of what codes represent them. Hosts may define the square bracket characters as X'BA' and X'BB' , or as X'AD' and X'BD'. We use hex mode on the Lua editor to modify the square bracket characters as X'AD' and X'BD' which will be displayed as Ý and ¨ and it works well during the execution.

    Thanks,
    Ankur Agrawal


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



  • 5.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Thu November 17, 2022 02:02 AM
    Hello Ankur -

    Thanks for the information.
    so, I have to put my code as below?

    a,b=string.find(strName,",")
    -- LuaSpcChr #\[]{}
    s={}
    sX'BA'1X'BB'="test"

    may I request for sample code to use this?


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



  • 6.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Thu November 17, 2022 02:04 AM
    Hello Ankur -

    I would request the representation for ˆ

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



  • 7.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Thu November 17, 2022 03:21 AM
    Edited by System Test Fri January 20, 2023 04:35 PM
    Hi Sampath, you need to open the lua editor in hex mode and sample code will look like this. Refer to the bold characters
    --------------
    sÝ1¨ = 'test'
    AAFB4747A8AA7
    2D1D0E0D3523D

    For Carrot symbol (^)  please use X'5F' it will display as ¬

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



  • 8.  RE: LUA script is not working in Optim 11.7 Z/OS

    Posted Fri November 18, 2022 10:51 AM
    "The special characters must be specified in the following order and all characters have to be specified."

    You are missing the tilde and the caret characters.

    Try the following:

    a,b=string.find(strName,",")
    -- LuaSpcChr #\~^[]{}
    s={}
    sX'BA'1X'BB'="test"

    ------------------------------
    ----------------------------------------------
    Tammy Ziegler
    tziegler@abmartin.com
    ------------------------------