Forum Replies Created
-
AuthorReplies
-
Quote:
Hard to tell. Why do you need two message handles if you KILL the original?
No reason.
Works like a charm.
Thanks Charlie for the help.
Thanks,
Brian
Quote:Sure is a lot of work to change one field in the MSH
The plan is since this proc will be used on several different routes. Once it is working the number placed in MSH6 will be passed in as an ARG to the proc. If you have a better solution I am open to suggestions.
I have changed to this:
Code:run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set msg [msgget $mh]
set fs [crange $msg 3 3]
set cs [crange $msg 4 4]
set rs [crange $msg 5 5]
set tmpMSH {}
set nmh [msgcopy $mh]
set nmsg [msgget $nmh]
set nmhseglist [split $nmsg r]
set segmentList [split $msg r]
foreach segment $segmentList {
set segmentid [crange $segment 0 2]
switch -exact — $segmentid {
MSH {
set splitsegment [split $segment $fs]
set tmpMSH $splitsegment
set tmpMSH [join [lreplace $tmpMSH 6 6 171003] |]
}
}
}set nmhseglist [lreplace $segmentList 0 0 $tmpMSH]
#create a new message and continue it on.
set nmh [join $nmhseglist r]
lappend dispList “KILL $mh”
lappend dispList “CONTINUE $nmh”}
Now I see ‘ (returned by ‘tps_MSH6GreenwayNumber ‘) does not match { } after the CONTINUE It looks like the message is working in both the route test and tps test but both show the message.
Thanks Again,
Brian
Assuming an regex like above where the expression is being compared to the same item in the message (ADT_AXX) Educated guess tells me N*2 where N is the length of the regex with 0 back references and 2 is the length of the string being compared. This would give us the number of comparisons required to determine a match. We also assume here that the CPU is executing one instruction per cycle with 0 no ops and on average a comparison creates 4 CPU instructions which is not entirely accurate but for sake of argument makes the example simple.
🙂 Now we can say 4(N*2) would be the number of Clock cycles to evaluate that expression. Since we know that we can theoretically reduce N by putting the most common value in the first comparison that would speed up the evaluation. This is all based on what i remember from a Computer Architecture class I had a couple years ago so this is by no means an exact formula just an idea of what takes place. I would always try and make the regular expressions as efficient as possible even tho the increase in speed will be small it is an increase none the less… 😀
-
AuthorReplies