simple tcl kill proc

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library simple tcl kill proc

  • Creator
    Topic
  • #54187
    Kevin Crist
    Participant

    i have what i assumed was an easy kill script but i cannot get it to work. it continues every message regardless of criteria, can anyone point out where i am messing this up at…code below

    Quote:


    #########################################################################################

    #########################################################################################

    #########################################################################################

    # Name: tpsKILL_FRAD_SC

    # Purpose: This tps tclproc will KILL status changes from RIS. This is only temporary.

    #      

    #

    #

    # UPoC type: tps

    # Args: tps keyedlist containing the following keys:

    #       MODE    run mode (“start”, “run” or “time”)

    #       MSGID   message handle

    #       ARGS    user-supplied arguments:

    # 1) The user can specify if we are to echo to log

    # The key is ECHOON

    # ECHOON = YES -> put entry in engine log

    # ECHOON = NO -> do not put entry in log (default value)

    # ECHOON = anything else -> Default to NO

    #

    # Example arguments: {ECHOON YES}

    #

    #

    # Returns: tps disposition list:

    #          Continues the messages as is

    # OR

    # Errors the message

    #

    # Created: Kevin Crist 05/1/2014

    #

    #

    #########################################################################################

    #########################################################################################

    #########################################################################################

    proc tpsKILL_FRAD_SC { args } {

    #########################################################################################

    # Get the Connection/Proc Name for Error/Debug Messages (NOT USED)

    #########################################################################################

    # global HciConnName

    # set myname “$HciConnName/[lindex [info level 1] 0]”

    # set nowis [clock format [clock scan now] -format “%D – %T”]

    #########################################################################################

    # Initialize Variables Used

    #########################################################################################

    set dispList

  •   ;# Disposition List Returned to Engine

    set fldSep “” ;# Field Seperator – get from MSH

    set subSep “” ;# SubField Seperator – get from MSH

    set repSep “” ;# Repeating Field Seperator – get from MSH

    set ORCpos -1 ;# Position of ORC Segment in msg

    set ORCList

  • ;# ORC Segment Fields in List Form

           

               

    set ORC_SC 1   ;# Status Change is in field 10            

    set ORC_Status 5 ;# Type of Status the status change is          

    #########################################################################################

    # Load in the arguments we need that were passed from the caller

    #########################################################################################

    keylget args MODE mode             ;# The mode the engine called from

    set echoon “NO” ;# Set to default Value

    keylget args ARGS.ECHOON echoon ;# The Engine Log output indicator

    set echoon [string toupper $echoon] ;# Use upper case in procedure

    #########################################################################################

    # Switch based on what mode the engine was in when it called the procedure

    #########################################################################################

     switch -exact — $mode {

      start { }

       run {

        set mh [keylget args MSGID] ;# Get message handle from args

         set dispList

      ;# Initialize to good message

           set msg [msgget $mh] ;# Get a copy of the message

           set fldSep [string index $msg 3] ;# Field Seperator

           set subSep [string index $msg 4] ;# Sub-Field Seperator

           set repSep [string index $msg 5] ;# Repeating Field Seperator

      set segList [split $msg r] ;# Split message into segList

      #########################################################################################

      # Find Position of Segements – If missing -> Error out Message and Return

      #########################################################################################

      set ORCpos [lsearch -regexp $segList {^ORC}]  

      #########################################################################################

      # Split up the Segments into Field Lists

      #########################################################################################

       set ORCList [split [lindex $segList $ORCpos] $fldSep]  

      #########################################################################################

      # Get the and Placer Number

      #########################################################################################

      set statusChange [lindex $ORCList $ORC_SC]

      echo statusChange: $statusChange

         set scType [lindex $ORCList $ORC_Status]

      echo scType: $scType

      #########################################################################################

      #If ORC.1 = SC and ORC.5 = 0 then KILL the message

      #########################################################################################

         if {[string equal $statusChange SC] && [string equal $scType 0] }  {

      set dispList

           

           

        }  

         

      }

         time { }

         shutdown { }

      } ;# End Switch

      return $dispList

      } ;# End Proc

    Code:
Viewing 2 reply threads
  • Author
    Replies
    • #80483
      James Cobane
      Participant

      Kevin,

      I think the issue may be that you are initializing the dispList with a “CONTINUE $mh”, then appending with a KILL $mh later.  Thus the dispList has both a CONTINUE and a KILL of the message.  I would simply initialize the disposition, then apply the disposition to the message handle based on the condition.

      i.e.

      set disp “CONTINUE”

      do your stuff and set disp to KILL if appropriate, then

      set dispList

        Just my $.02

        Jim Cobane

        Henry Ford Health

    • #80484
      Kevin Crist
      Participant

      Thanks for the reply. I guess what confuses me is that this is basically the same KILL script i use many times over, just copy and paste and change variable/condition and this is first time i have had this issue.

    • #80485
      Kevin Crist
      Participant

      ok, found my issue. Apparently when i am looking in the ORC.5 field for what i thought was the number 0 but it was in fact the letter O.  ðŸ˜³

      I changed that and all is working as exprected. Thinking i need to call it a week.

      Thank you.

Viewing 2 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forums

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,448
Topic Tags
288
Empty Topic Tags
10