Trying to increment MSG ID for an FT1 split

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Trying to increment MSG ID for an FT1 split

  • Creator
    Topic
  • #54045
    derek march
    Participant

      I have a site that needs to have an FT1 split.  Basically if a message has MSH, EVN, PID and 5 FT1 segments my xlate splits that into 5 separate messages, each having MSH, EVN, PID and 1 of the FT1 segments.  

      In MSH-10 there is a message ID, I need each of the 5 messages to have a unique message ID.  And subsequently that number needs to be unique from every other message in the file.

      What I’m attempting to do is store MSH-10 as @msgid before the iterate, then copy MSH-10 back into the messages after the iterate command.  I assume there is something I can write into the pre-proc area of the second copy to increment the message ID number, but I am not well versed enough in TCL to know what to do.

      Any help would be great, thanks

    Viewing 2 reply threads
    • Author
      Replies
      • #79969
        Terry Kellum
        Participant

          Personally, I would use an @variable in the translate and use MATH to increment it after each CONTINUE.  You can then CONCAT this on the back of the existing Message ID, and that gives you the benefit of being able to trace it back to the parent by the Message ID.

          Code:


          =1   COPY   @MessageNumber

          :Start message stuff

          0(0).MSH(0).#10(0).[0]    CONCAT     0(0).MSH(0).#10(0).[0]
          @MessageNumber

          -> CONTINUE

          @MessageNumber    MATH ADD       @MessageNumber
          =1

          :Do next message stuff

          0(0).MSH(0).#10(0).[0]    CONCAT     0(0).MSH(0).#10(0).[0]
          @MessageNumber

          -> CONTINUE

          @MessageNumber    MATH ADD       @MessageNumber
          =1

          …….

        • #79970
          Shaun Beckman
          Participant

            Attached is a sample xlate that will help get you started, but keep in mind each message will have the same Msg ID.

          • #79971
            Jim Kosloskey
            Participant

              If there is no inbound MSH-10 to use as a basis or if it is too long to add sufficient differentiation and stay within the HL/7 version field size limit then you can use Tcl and a Counter file or other techniques.

              If you are unsure of how to do the Tcl, email me and I will send you a proc which creates a unique Control ID which can be used with HL/7 or any mesage structure which requires a unique Control ID.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

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