Gloabls in Tps

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Gloabls in Tps

  • Creator
    Topic
  • #53001
    Michael Lacriola
    Participant

      Seems like a simple idea, but I cannot execute proper syntax. I have an inbound thread that is receiving multiple ADT messages. The messages come in order by person. Meaning I’ll have maybe 4 messages for mrn 1, then maybe 3 for mrn 2, then maybe 8 for mrn 3, etc …

      What I would like to do is send only the first one through and skip the remaining for that mrn to reduce load. I can accomplish list be writing out a temp file for the first message received, send on the ADT, when I get the next message, I can see if that file already exists, and if it does, kill message. Straight forward….

      However, it seems that a global in Tps proc would work instead of all the extra disk io. In startup mode, set prevMRN {}. In run mode, grab mrn from message (set currMRN to value in PID-3), compare to prevMRN. If same, skip message, if not, continue message and set prevMRN to currMRN. Logic is easy. Syntax on the global, not so much. I’m lacking the knowledge.

      First off, can this be done using a global in a single Tps? If so, where to define prevMRN and how? The currMRN is defined in run mode when I grab PID-3. I’m just can’t seem to get proper sysntax around prevMRN correct.

      Help!!! To quote a movie, “Why do we fall? So we can learn to pick ourselves up.”

    Viewing 4 reply threads
    • Author
      Replies
      • #76209
        bill bearden
        Participant

          proc tpsCheckPrev {

           global prevMRN

           blah blah

           switch…

             start { set prevMRN {} }

             run { check against prevMRN and possibly set it again. }

             blah blah

           }

           blah blah

          }

        • #76210
          Michael Lacriola
          Participant

            I’ll give it a try.

          • #76211
            Michael Lacriola
            Participant

              No joy. Get and error in RUN mode stating that can’t read $prevMRN: no such variableduring cequel command which look s like this:

              if {[cequal $prevMRN $currMRN]} {….}

              The tps is within the IB xlate routing thread. The global prevMRN is defined right under global HciConnName, the set prevMRN “” is defined in start up switch, the cequal command is within run switch.

              I also make sure the engine processed in stopped/restarted before trying it. Frustrating for a simple idea.

            • #76212
              Charlie Bursell
              Participant

                There is no start-up in Xlate procs by default.  In NetConfig click on the Process Option at top of screen then Configure -> Run Translation procs in start-mode.

                An alternative woul be to do the following in run mode (assuming you have declare var as global)

                if {![info exists var]} {set var “”}

                The above would be true only the firts run mode.

              • #76213
                Michael Lacriola
                Participant

                  I guess the kicker was that I was running the proc in the IB Xlate Tps. I never knew that a Tps proc would never run in the “start” mode of an IB/OB xlate Tps.

                  I chose to use the alternative method instead of setting the “start mode” in the engine process configuration. The alternative solution worked perfectly.

                  As for why I chose the alternative method: fear of the unknown. I did not like the concept of changing the overall engine process to have it run xlation procs in start mode. I never had a need for that until now and I would probably forget that I set it.

                  The alternative is a very clear and self documenting when looking at the code. Very easy to understand.

                  Thanks again.

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