MOD10 TCL PROC?

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf MOD10 TCL PROC?

  • Creator
    Topic
  • #47543
    Anonymous
    Participant

      Does anyone have a MOD10 tcl that they would like to share? I need to add the check digit back to the doctor before it enters the hospital system…

      Thanks in advance! Mary

    Viewing 0 reply threads
    • Author
      Replies
      • #56102
        Steve Drozdowski
        Participant

          Here is a snippet of code that should work:

          proc checkdigit { no } {

                 set pos [string length $no]

                 set t “”

                 foreach i [split $no “”] {

                         incr pos -1

                         append t [expr $i * (2 – $pos % 2)]

                 }

                 set result [expr (10 – [cross_sum $t] % 10) % 10]

          }

          proc cross_sum { s } { expr [join [split $s “”] “+”] }

          HTH!

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