can not find channel error on puts

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf can not find channel error on puts

  • Creator
    Topic
  • #52823
    Johnny Anderson
    Participant

      CL v5.8, Sun, Solaris 10. Using testing tool for a tclproc.

      Trying to use a variable in ChannelId for a Puts command.

      Example: ChannelId should be:  fr_op_file_region_13

      This works:    puts  -nonewline $fr_op_file_region_13   $hold_rec_type01

      This doesn’t:  puts  -nonewline $fr_op_file_region_$fr_pcms_region   $hold_rec_type01

      Pertinent tclcode:

             set fr_op_file_region_13 [open $path/hl7oru_to_hl7fr_region_13x.txt w]

         

             if {$fr_rec_type == “02”} {

                 set fr_pcms_region [csubstr $fr_ip_rec 56 2]

                          echo “+++ region : ” $fr_pcms_region

                 if {[lsearch -exact $region_list $fr_pcms_region] >= 0} {

                          echo “+++ lsearch good, region : ” $fr_pcms_region

                 } else {

                          echo “+++ lsearch bad, region : ” $fr_pcms_region

                        }

             }

                 if {$fr_rec_type == “02”} {

                           set ZZZ fr_op_file_region_$fr_pcms_region

                           echo “+++ ZZZ: ” $ZZZ

                     puts -nonewline $ZZZ $hold_rec_type01 <


      fails here

                                                                     

             

             close $fr_op_file_region_13

             

      Testing tool results:

      +++ region :  13

      +++ lsearch good, region :  13

      +++ ZZZ:  fr_op_file_region_13     <


      value looks correct

      [0:TEST] Tcl error:

      msgId = message0

      proc = ‘fr_region_split’

      args = ”

      result = ‘can not find channel named “fr_op_file_region_13″‘

      errorInfo: ‘

      can not find channel named “fr_op_file_region_13”

         while executing

      “puts -nonewline $ZZZ $hold_rec_type01”

         (procedure “fr_region_split” line 94)

         invoked from within

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

    Viewing 1 reply thread
    • Author
      Replies
      • #75587
        John Mercogliano
        Participant

          What is happening is that the ZZZ variable is passing the variable name to puts instead of the channel name being held by the variable name. Try changing your code as follows

          Code:


          # Old
          puts -nonewline $ZZZ $hold_rec_type01
          #new
          puts -nonewline [set $ZZZ] $hold_rec_type01


          Executing the set on the variable name should cause it to return the channel name.

          Hope this helps for you.

          John Mercogliano
          Semi Retired, contractor
          Hampton Roads, VA

        • #75588
          Johnny Anderson
          Participant

            Thanks John, that fixed it.

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