› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Message Control ID
Any ideas would be great
There are some Tcl (Tclx?) calls for this sort of thing. There is a good thread on this. I’m pretty sure this is covered in the Level 2 class. Good stuff.
https://usspvlclovertch2.infor.com/viewtopic.php?t=6261
This thread mentions the Tcl procs you call to do this. When I search our xlates, the call I normally see is something like this in a Pre Proc on an Xlate COPY command:
set xlateOutVals
]
But I think you have to set up the counter file before you use it.
You can make use of the cloverleaf message id in an xltp.
set msgID [xpmmetaget -ro $xlateId MID] ;# gets the message id as a keyed list
set xlateOutVals “[keylget msgID NUM]” ;# established xlateOutVals value.
Kevin,
As Bill and Keith have pointed out there are many ways to accomplish this in Tcl.
The real question is how unique does the number need to be. In HL/7 it is hinted the number should be absolutley unique (that is guaranteed to never repeat).
However, in practice various system have various levels of demand (or maybe none at all).
We had a system at my last location which exchanged information with virtually every system in the Hospital (and potentially outside) and their requirement was that a Control ID could NEVER repeat EVER!
So we devised a Tcl proc that utilized the epoch time a literal and a counter to get an ID that we were fairly confident would never repeat. Each Integration had its own counter. The counter was used to break ties at the epcoh time since it is only to a second and we all know we can receive and deliiver multiple messages per second.
While there are a lot of potential uses for the Control ID, the primary use I see is to tie acknowledgtments and messages together. However, most vendors don’t know how to properly use the Control ID in Acknowledgments so that value is rather spotty.
At first blush the MsgID would seem to fit the bill. But if you are multiple site the potential is there that messages originating in diferent sites would have the same last octet. Since the beginning octets are always zero unless using the new cross-site routing cpapability (and then the changing octet is not reliable) there is no assurance of absolute uniquentess.
For the system I spoke of an additional negativefor the MID is it will repeat at some time (albeit a long time) even if single site and remember the receiving system indicated the Control ID could NEVER repeat EVER!
email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.
I almost always use a combination of the date and time down to the seconds and the cloverleaf message id.
Using an xlate proc (xltp) …
proc xltp_set_msg_id {} {
[code]proc xltp_set_msg_id {} {
-- Max Drown (Infor)
Here’s a code snippet for getting the Cloverleaf message ID in a TPS tcl proc.
# Get the message ID
set midList [msgmetaget $mh MID]
keylget midList NUM msgId
-- Max Drown (Infor)
You can create a guid or uuid using this code:
package require uuid
set guid [::uuid::uuid generate]
Looking at the discussion on the tcl wiki <a href="http://www2.tcl.tk/10871″ class=”bbcode_url”>http://www2.tcl.tk/10871, it appears that under certain conditions there could be a time delay because part of the value is obtained through a socket call.
On my AIX server, it takes about 260 milliseconds.
According to the IETF draft:
A UUID
is 128 bits long, and if generated according to the one of the
mechanisms in this document, is either guaranteed to be different
from all other UUIDs/GUIDs generated until 3400 A.D. or extremely
likely to be different (depending on the mechanism chosen).
Peter Heggie
PeterHeggie@crouse.org
However you generate your Control ID just be cognizant that until Version 3.6 – sorry I meant 2.6 of HL/7 there is a 20 character field length on the Control ID.
While you can easily change that length in Cloverleaf some receiving systems actually are sensitive to that length.
email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.
If we are sending to a system receiving data from multiple sources, we will typically prefix the Control ID with a value/mnemonic representing the source system, along with a 10-digit counter value. This will insure uniqueness across systems. i.e.
INV0000456865
EPC0000342456
Jim Cobane
Henry Ford Health