Tom is on the right track. You don’t even need to append the messages in a file. FTPing a file around would be messy I think.
You can “hold” the messages in Inbound TPS until you get the entire batch.
This has the added advantage of being recoverable. If the engine goes down it will reprocess the messages that are being held.
Asuume the message will have an “append_flag” in it which you will extract.
Assume the last message in the batch will have an “append_flag” that is false.
Assume the messages that need to be appended will come back-to-back.
Here’s some logic for you:
global msg_list
set dispList “”
keylget args MODE mode
switch -exact — $mode {
start { set msg_list “” }
run {
keylget args MSGID mh
# Extract append_flag from the OBR
# … extract logic goes here …
# Check the append flag
if $append_flag {
# Save this message handle in a global list
lappend msg_list $mh
# Hold the message (return nothing) until we get the entire batch
set dispList “”
} else {
# If we have a msg_list, this is the last message in the batch
if { “$msg_list” ne “” } {
# Append the messages into one – create a new msg handle to hold the batch
set batch_mh [msgcopy $mh]
msgset $batch_mh “”
lappend dispList “CONTINUE $batch_mh”
# Loop over the list and append messages as we go
foreach msg $msg_list {
set heldMsgData [msgget $msg]
# you may need to modify heldMsgData here to get rid of MSH, etc
# Append the data to our batch msg and kill the held msg
msgappend $batch_mh $heldMsgData
lappend dispList “KILL $mh”
}
# Clear our global list
set msg_list “”
} else {
# No batch, just continue this message
lappend dispList “CONTINUE $mh”
}
}
}
time {}
shutdown {}
}
return $dispList
Rob Abbott
Cloverleaf Emeritus