TCL CODE – HELP WITH ERROR

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf TCL CODE – HELP WITH ERROR

  • Creator
    Topic
  • #49483
    Femina Jaffer
    Participant

      We have code that we used in 3.8 for a test system and it worked correctly.  We have upgraded to Quovadx 5.5, and are running tests transactions through various systems.  This same code is now generating an error.  Could someone please look at this and tell me where the extra switch is?

      The message in the testing tool is as follows:  (I have also attached the code).

      [0:TEST] Tcl error:

      msgId = message0

      proc = ‘sage_res2’

      args = ”

      result = ‘extra switch pattern with no body’

      errorInfo: ‘

      extra switch pattern with no body

         while executing

      “switch -exact — $mode {

             start {

                 # Perform special init functions

         # N.B.: there may or may not be a MSGID key in args

            …”

         (procedure “sage_res2” line 6)

         invoked from within

      “sage_res2 {MSGID message0} {CONTEXT sms_ib_data} {ARGS {}} {MODE run} {VERSION 3.0}”‘

      Thank you.

      Femina

    Viewing 7 reply threads
    • Author
      Replies
      • #62147
        Scott Lee
        Participant

          This line, I think, may need ‘–‘ after ‘-exact’.  

          Code:

          switch -exact $segID {

          so it looks more like this line…

          Code:

          switch -exact — $mode {

          The ‘–‘ signals the end of the switches.

          Just a guess obviously, since I have not tested it…

          Good luck!

          Scott

        • #62148
          Femina Jaffer
          Participant

            Thank you Scott.  But unfortunately that did not correct the error.

            Femina

          • #62149
            John Hamilton
            Participant

              Remove the ” ;# run mode” at the end of the run swith section. Not sure what is in that field or why.

              I removed it and it ran fine.  Or at least not with that error.

            • #62150
              Femina Jaffer
              Participant

                Thank you!  I took all the ‘;’ and it works.

                Thank you all for your help.

              • #62151
                Charlie Bursell
                Participant

                  The body of the switch which contains all of the different cases to check is not code, it is data to the switch command, switch decides what to do with the data itself and switch does not support comments in its data. The body of each case is a block of code and as such can contain comments.

                • #62152
                  Femina Jaffer
                  Participant

                    Thank you Charlie. Point noted.

                    Femina

                  • #62153

                    This is very … odd … behavior in tcl. I did some testing with this error awhile ago to try to figure out the problem. Here is some sample tcl that hopefully will shed more light on it.

                    Code:

                    set mode “#”
                    switch -exact $mode {
                       1 { # do nothing }
                       2 { # do nothing }
                       3 { # do nothing }
                       # { puts “this is NOT a comment!” }
                       default { puts “$mode mode not found” }
                    }

                    Notice that the # is interpreted as an option in the switch and not as the start of a comment.

                    -- Max Drown (Infor)

                  • #62154
                    Ed Mastascusa
                    Participant

                      FWIW,

                      we also encountered this error in a few (unmodified) tps procs moving from 5.3 to 5.5.

                      all of our problems involved trailing “;#” comments after the }s that ended the final case body. Removing the comments got rid of the run-time errors.

                      i.e. we had

                      switch

                      ..

                      last pattern {

                      }   ;# trailing comment

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