Message control ID

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Message control ID

  • Creator
  • #49805
    Rick Pritchett

    I have a vendor that requires MSH10.  I was wanting to use a counter and append it to the date does anyone have a good example to get me started?

Viewing 3 reply threads
  • Author
    • #63665
      Jim Kosloskey


      I have a proc you can use.

      Email me and I will send it.

      Jim Kosloskey


    • #63666
      Tom Rioux

      You could always do something like the following:

      In the xlate, set up your copy as:

      =NO_VALUE  —>   MSH.#10

      Then in your tcl fragment for the copy:

      set xlateOutVals [CtrNextValue SOMECTR]

      The “SOMECTR” is a variable that will hold the counter.  This should give you a unique number in MSH.10.   I’m not sure if that counter has an upper limit built in or not.  Charlie or Jim might be able to tell you.

      Thanks…Tom Rioux

    • #63667
      Jim Kosloskey

      The counter file has a limit based on the size set when it is initialized.

      The default is something like a 9 digit value.

      The initialization allows you to set the name for the counter file, the initial value, the maximum default, and the reset value.

      All of this is covered in the Cloverleaf(R) Reference Guide under Tcl Extensions –> Counter Commands

      What we use here is a concatenation of the epoch time (we are AIX) a 4 character literal (typically identifying the source of the message) and a 4 digit counter.

      The above pretty much assures a unique message control ID (assuming proper use of the literal value) vertically and horizontally (that is within a given system and among various systems).

      The reason we use the counter is the epoch time is only resolved to the second. We definitely send many messages per second to the destination. The counter breaks the tie. The literal provides for uniqueness when messages from multiple source systems of various types (ADT, Orders, Results) and Sources (Multiple Hospitals, Regular Lab, Radiology, dictation, etc.) are to be sent to a single system which requires each MSH have a unique NEVER repeated control ID.

      Remember the MSH-10 Control ID does not have to be numeric. It is not necessarily a sequence number (that is another MSH field).

      Theoretically randomly assigned characters could be used for MSH-10.

      Many receiving systems are not as picky as the one for which the above was designed. But the Control-ID we use can be utilized for any system and virtually any message construct where control ids are needed (HL/7, X12, etc.).

      Ideally we would like all source systems to provide a uniques Control ID. That way we can easily trace the message through the engine and onto it’s final destination as well as matching the acknowledgments to the original message.

      Alas, that does not happen very often and when it does, the Control IDs provided are typically just counters that eventually repeat. That means multiple source systems could send messages with identical Control IDs.

      So we have this proc for when the source system does not provide a Control ID.

      I like doing it in the Xlate rather than a outbound proc because then the Control ID stays with the message on a resend (one does not have to remember to resend post TPS).

      Jim Kosloskey


    • #63668
      Tom Rioux

      We used the code that I posted primarily for a system that uses the MSH.10, not necessarily because it wants a unique ControlID for each message, but uses to merely check for duplicate messages being sent back to back.  

      I like the sound of your code Jim.  If I ever run into a situation where I need it, I will hit you up for it.

      Thanks…Tom Rioux

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

Forum Statistics

Registered Users
Topic Tags