App Connect

 View Only

Calling DB with passed in params in a shared lib.

  • 1.  Calling DB with passed in params in a shared lib.

    IBM Champion
    Posted Thu April 15, 2021 05:49 AM
    Hi Folks,
    I've wrappered a stored proc in an ESQL module process (and placed it all in a shared library) e.g.

    CREATE PROCEDURE ProdNameDB()
    LANGUAGE DATABASE DYNAMIC RESULT SETS 1
    EXTERNAL NAME ExternalStoredProcedureName;

    which is called by...

    CREATE PROCEDURE ProcName(INOUT Ref REFERENCE)
    BEGIN
    CALL ProcNameDB(Ref.Row[]) IN Database.{DBSchema};
    END;

    I'm having a problem with passing the location where I want the result to be put to . (You'll note that I'm forced to set the location I need the result in ("Row")  in the call to the DB proc i.e. 
    CALL ProcNameDB(Ref.Row[])

    This works - but I would rather the caller of the procedure passed in the location e.g. 

    CREATE PROCEDURE ProcName(INOUT Ref REFERENCE, IN location CHAR)
    CALL ProcNameDB(Ref.{location}[])

    but I can't find the correct cantation.
    I have tried everything I can think of, including EVAL.

    Ideally I'd like to use the Ref as it stands e.g. they pass in Environment.location[] and I don't need the second param in the wrapper method but that doesn't work either;

    Anyone got a clue as to what the magic words should be for either solution?

    thanks folks,
    John.

    ------------------------------
    John Hawkins
    Integration Consultant
    ------------------------------