SSN RJZF

  • Creator
    Topic
  • #52526
    Deborah Bauer
    Participant

      Newbie…Could someone show me how in tcl code to make the SSN RJZF(right justified zero filled)?  We have a few SSN that are coming over in HL7 PID segment as eight digits but I need to send it as a nine digit with a leading zero.  Your help would be greatly appreciated.  Thank you! Deborah

      ex. Incoming:  11223333

          Out: 011223333

    Viewing 2 reply threads
    • Author
      Replies
      • #74558
        Frank Grube
        Participant

          set x [format “%09d” $i]

        • #74559
          Charlie Bursell
          Participant

            Unless you have personally created the number, I would recommend strongly against using “d” in the format statement. If the field is empty or has a non-number it will cause a Tcl error.  Use “s” instead.

            Example:

            set i “”

            format “%09d” $i

            Error: expected integer but got “”

            format “%09s” $i

            000000000

          • #74560
            Deborah Bauer
            Participant

              Got it!  Thank you for your help!

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