Hi
I had a few errors in the code but below is a working tcl script :
proc set_outbound_name {args} {
set dispList {}
# Get mode
set mode “”
catch {keylget args MODE mode}
if {$mode ne “run”} {
return $dispList
}
# Get message ID
set msgid “”
catch {keylget args MSGID msgid}
if {$msgid eq “”} {
echo “DEBUG: MSGID missing”
return $dispList
}
# ✅ Get FULL existing DRIVERCTL
set driverControl [msgmetaget $msgid DRIVERCTL]
# Get original filename
set fname “”
catch {keylget driverControl FILENAME fname}
if {$fname ne “”} {
echo “DEBUG: Existing filename = $fname”
set base [file tail $fname]
if {[string match “WBS*” $base]} {
echo “DEBUG: WBS match found”
regsub {^WBS} $base “NIBTS” newbase
echo “DEBUG: New filename = $newbase”
# ✅ SAFE UPDATE — do NOT overwrite DRIVERCTL
keylset driverControl FILESET.OBFILE $newbase
# (optional but fine to keep)
catch {keylset driverControl OUTFILE $newbase}
# Save updated structure
msgmetaset $msgid DRIVERCTL $driverControl
echo “DEBUG: DRIVERCTL updated (OBFILE patched)”
}
}
# ✅ Correct return
lappend dispList “CONTINUE $msgid”
return $dispList
}
Thanks again for your help – much appreciated