Global variables in cloverleaf 5.8

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Global variables in cloverleaf 5.8

  • Creator
    Topic
  • #53249
    Graham Hartley
    Participant

      Hi,

      Just a quick question.  Would you expect global variables set in the Inbound TPS to be available in Xlate Pre and Post Procs?

      The reason I ask is that we connect to a database at startup in the inbound tps and store the handles in global variables.  We want to use the same database connection in the pre xlate proc.

      Thanks in advance,

      Graham

    Viewing 6 reply threads
    • Author
      Replies
      • #77049
        Jim Kosloskey
        Participant

          Graham,

          I believe this may work…

          In NetConfig GUI, select the ‘Process’ Menu item, then Click on ‘Configure…’, then for the Process in question, select the ‘Properties’ tab and check the ‘Run translation Procs in Start Mode’ checkbox.

          Then your pre (and perhaps post) procs are run at startup. I suspect you could simply declare your handles as global in those procs or you may need to copy them or something to get them in the Xlate P-Thread namespace.

          However, Tom Rioux found some issues with that under certain recovery circumstances as I rcall.

          If Tom is listening maybe he will join in – otherwise you might want to reach out to him directly.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #77050
          Charlie Bursell
          Participant

            No.  The IB thread and Xlate threa run in different interpreters

          • #77051
            Graham Hartley
            Participant

              OK Thanks both.  I will look into using a separate namespace for the odbc variables and see how I get on.

              Thanks again,

              Graham

            • #77052
              Graham Hartley
              Participant

                Hi,

                I have been experimenting with namespaces to try and resolve this problem without success however I have learnt alot about namespaces!

                The ultimate aim is to be able to store the database connection handle generated in the inbound TPS and reuse it in the Pre Xlate proc.

                As I now know that the IB and Xlate thread run in different interpreters I thought I could share this handle using a namespace variable but I can

              • #77053
                Jim Kosloskey
                Participant

                  Graham,

                  Do you really need to connect in the TPS?

                  If you configure to have your route pre-procs invoked at startup couldn’t you do the connect there? That is in one interpreter.

                  Unless you are actually referencing the DB in the IB thread wouldn’t this potentially work?

                  email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

                • #77054
                  Charlie Bursell
                  Participant

                    It will do you no good to pass the connection handle via metadata.  That handle is known only to the interpreter where it was created

                  • #77055
                    Graham Hartley
                    Participant

                      Thanks both,

                      Jim – I was hoping to use the same connection handle in both the IB and Xlate Pre Proc to save having to connect to the database again.  Currently we connect to the database in the IB startup so we can store the messages and execute various stored procedures.  I then hoped to use this same connection handle to access the database in the Pre Xlate.

                      As this dosen’t seem possible I think I will shelve the idea and maybe look at moving the code from the pre Xlate into the IB tps instead.  

                      Regards,

                      Graham

                  Viewing 6 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.