InfoSphere Optim

 View Only
  • 1.  Exit routines for Optim

    Posted Wed March 06, 2019 10:27 AM
    Hello,

    Can anyone tell me if you can use C# for an Exit routine, and if so, can anyone provide a sample?

    Thank you!

    ------------------------------
    Trong Bo
    Senior Environment Administrator
    HealthNow New York
    ------------------------------

    #InfoSphereOptim
    #Optim


  • 2.  RE: Exit routines for Optim

    Posted Wed March 06, 2019 01:18 PM
    I hope someone else can reply specifically about C#. 

    I can answer more generally that Optim should be able to support any programming language for an Optim column map user exit routine; HOWEVER some are easier than others.​ 

    My experience with the easy part is: the Optim column map user exit interface supports any "3GL" programming language.  The interface is defined in C structures (fixed format control blocks in memory), so you do have to rewrite those C structures into the new programming language, once.   That's pretty easy.  I haven't used C# but I bet you can just reuse the C structures in C#.

    The hard part is: many programming languages require a runtime environment to be established before they are called, or else the environment will be set up on the call, and torn down on the return from that call to the exit.  Obviously the setup and tear down can get expensive in performance, when it is done on every call.  It is almost always more complicated to write the code to keep the runtime environment around between calls, and it is almost always worth it performance wise. 

    You can worry about the performance second, though, after you get the connection going and get correct results!

    ------------------------------
    Peter Costigan
    Offering Manager, Optim Solutions
    IBM
    San Jose CA
    ------------------------------



  • 3.  RE: Exit routines for Optim

    Posted Wed June 03, 2020 03:58 PM

    Okay, I would like to revive this tread if I may.  I seem to be jumping through hoops in order to create an exit in C#.  So far I find it is not even possible without the use of a wrapper. For example I can write an exit in C++/CLI, which basically is the translator between managed memory programs and unmanaged memory programs. 

    I would love to hear from you if you been able to accomplish this, or at least have experience making calls between C++/CLI, C# and back again.

    ----
    Now, with that plea for help here was here I currently am.

    I am able to create a C++/CLI wrapper DLL that can be called by Optim.  That DLL can then call a C# DLL to perform other activities.  However, there is a limitation. Non-blittable data types are not easily handled between the managed and unmanaged memory.  Okay, what is non-blittable you may ask? I did too.  I swear, I would love to know where people come up with these terms sometimes.  Anyway, blittable is a data type that has the same representation in memory in both C++/CLI and C#.  Non-blittable is the opposite.

    What it means in simple terms is that things like pointers to functions, arrays or even strings are not easily transferred between C# and C++/CLI.  Not at all in some cases.  Which means the C++/CLI process will need to convert the entire PST_STRUCT_CM_EXIT_COL and PST_STRUCT_CM_EXIT_PARM structures to something understood by C#. Also, some of the elements in those structures (like the function pointers) can not be interchanged between managed and unmanaged memory.  Basically, C# can not call a C++ function by pointer (that I am aware of).

    So, my thought, instead of translating or marshaling the structures to something passable to C#, it may be better to create callbacks in the C++/CLI wrapper that return the specific elements required from the structures (including the use of the callback function pointers in the structures). In this way, all work can be done in the C# code by calling functions back to the C++/CLI code.  I suppose that means the wrapper will need a ton of callbacks in order to handle the various data elements and functions it will need to call. I wonder if it is even worth using C# at all.

    Anyone have any thoughts?

    Thanks,
    - Tammy





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



  • 4.  RE: Exit routines for Optim

    Posted Wed March 03, 2021 01:00 PM
    nice work

    ------------------------------
    ელექტრიკი გამოძახებით
    eleqtriki-gamodzaxebit-tbilisi
    ელექტრიკი გამოძახებით
    Tbilisi
    ------------------------------