TCL to write message to the error database.

Clovertech Forums Cloverleaf TCL to write message to the error database.

  • Creator
    Topic
  • #118875
    Mike Campbell
    Participant

      “Anyone have a tcl proc that will send an HL/7 message to the error database? Called from within an Xlate. We are migrating to use jdbc queries and am finding out when the database isn’t available there is a message logged in the site.log and site.err, but the message isn’t sent to the error database. CL vs. 19.1.2.2”

    Viewing 3 reply threads
    • Author
      Replies
      • #118876
        David Barr
        Participant

          You can probably just say something like:

          error “my error description here”

          and that will cause a TCL error which normally sends messages to the error database. You can probably call that from an Xltp if you need to do it from an Xlate.

        • #118877
          Jim Kosloskey
          Participant

            On the Action where you invoke your Tcl to query the DB there is a place to specify what should happen if an error is thrown, then in your code use the XPMERROR statement.

            Look up the XMPERROR statement in the User Doc for the up-to-date usage.

            Are you using the XPMERROR and it is not working? I know it did not work in some CL releases but I thought it was fixed by 19.x.

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

          • #118885
            Mike Campbell
            Participant

              With some expert help and guidance from Jim Kosloskey, I was able to get the xpmerror to work and send the message to the error database.

              Thanks all!

            • #118890
              Mike Campbell
              Participant

                A brief follow-up.  This is mainly to those new to utilizing the jdbc process to query external databases.  I won’t go through setting up the jdbc ‘tables’ used but rather on how to handle errors.

                Cloverleaf – 19.1.2.2

                We discovered that if there was a connection error, information would be written to the .err and/or .log.  Nothing real-time was sent stating an error occurred.  The message would still be sent, however the information might be missing or incorrect if based on the query result.

                To remedy that we created an email tcl proc to check the built-in jdbc error flag of @tbl_errno.  0 [zero] is successful.  -1 is an error condition.  Greater than 0 means multiple rows were returned.  So, if -1, we generate an email stating the error, with information needed for research, etc.  We also created a tclproc to send the mesasge to the error database, and suppress it from being sent out.

                The error database tcl uses:  xpmerror xpmId severity message – to do the work.  Fairly easy to work with.

                 

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.