TCL Proc- Create new OBX seg if OBX|5 contains over 68 chars

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf TCL Proc- Create new OBX seg if OBX|5 contains over 68 chars

  • Creator
    Topic
  • #48172
    Roushanak Sedghi
    Participant

    Hello all,

    We have an outside vendor that can not handle OBX segments containing more than 68 characters

    Does any one have a TCL proc to create a new OBX segment when OBX|5 contains more than 68 characters.

    Thank you in advance

Viewing 6 reply threads
  • Author
    Replies
    • #57898
      Rentian Huang
      Participant

      Roushanak,

      Try this code, hope it helps.

      -Sam  ðŸ™‚

      Code:

       
         ITERATE: group  Basis: 1(0).1(0).1  Variable: %g1
         CALL:    Source: @gIndex, 1(0).1(0).1(%g1).OBX.00573.[0]      Destination: @gIndex
         
         set i [lindex $xlateInVals 0]
         set OBX5 [lindex $xlateInVals 1]
         set addr {1(0).1(0).1(index).OBX.00573}
         
         if {[string length $OBX5] > 68} {
             set pos 0
             while {$pos < [string length $OBX5]} {            regsub index $addr $i addr            xpmstore $xlateId $addr c [string range $OBX5 $pos [expr $pos + 67]]            regsub {(d+).OBX} $addr (index).OBX addr            incr pos 68            incr i        }    } elseif {[string length $OBX5] > 0} {
             regsub index $addr $i addr
             xpmstore $xlateId $addr c $OBX5
             incr i
         }

         xpmstore $xlateId [lindex $xlateOutList 0] c $i

    • #57899
      Roushanak Sedghi
      Participant

      Thank you Sam for your help with the TCL

    • #57900
      Bryan Mckay
      Participant

      I have just run into the same issues,  thanks for the help Sam!

      I have 2 additional questions

      1.  How would I write the tcl to know not to start the next obx at 68 when 68 is in the middle of a word?   Therefore needing to find a good place pre-68 to start the new OBX.

      2.  Also the sending system will send data in multiple OBX

    • #57901
      Tony Benitz
      Participant

      Bryan, etal.

    • #57902
      Bryan Mckay
      Participant

      Thank you very much,  I appreciate the help greatly!!

    • #57903
      Paul Johnston
      Participant

      Tony,

      I found your note just after I created my question .

      Your solution looks like it might work for us .

      Just curious . Do you think this could work for OBX segments as well. ?

      Thanks

      Paul

    • #57904
      Amol Kulkarni
      Participant

      Hello Roushanak,

      The attached tcl limits a specific field (in this case NTE comment field) to 70 chars. You could modify it to the OBX field. Hope this is what you are looking for.

      The proc works only when called from a code fragement.

      Amol

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

Forum Statistics

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